I use a camera object in my game, and I would like to know how to rotate the Box object I'm using for the camera's collision system. I can rotate the camera, and can use the camera's Look vector to move the camera around… Just how do I turn the box around accurately?
Okay well I got the camera object to work perfectly fine…. But now I'm receiving and error when I'm creating a body for my bullets. The error is in CollisionSystemSAP under Detect all Collsions in the following line of code
skinTester_.Set(this, collisionFunctor, collisionPredicate, collTolerance);
// I know that each skin for the bodies is already in my list of skins.
// Thus, I can do collision between all skins, culling out non-active bodies.
int nSkins = skins_.Count;
// BEN-OPTIMISATION: unsafe, remove array boundary checks.
for (int i = 0; i != nSkins; ++i)
The actual error is an out of bounds index for an array (its happening at the AddToActive line). Since I have no clue about the code inside of the Physics engine itself, will someone please help me out?
Are you sure the error is on that line, or that it is an out of bounds array index error? Because that line is in an unsafe block which as far as I know means array bounds checking shouldn't be taking place.
Are you using multiple threads? Unless you're running multiple threads I can't see how that loop could go wrong. Mind you I don't particularly like the "!=" instead of "<" syntax as in slightly more complicated loops it can cause some problems.
I was having something similar but this happened to me when I was disabling or re-enabling bodies during the callback functions which were being applied. So now I do the collision checks, flag things and being active or inactive then after the check, switch of the bodies and disable them after. I hope that made sense, I'm tired…