The True Axis Physics SDK uses the term collision grid to describe a 2D grid used to separate space. Objects are placed into grid segments based on there location. When an object is moved, only near by grid segments need to be checked for other objects that could cause a collision. This way, the simulation can easily cope with thousands of dynamic objects. A collision grid has the advantage of being very fast for level layouts that can be represented well by a 2D map.
Sometimes, a 2D grid may not do a good job of dividing the world. The collision grid solution has problems with dynamic objects that are larger than a grid segment. The collision grid copes best with a world containing evenly distributed objects. Large sparse areas with small pockets of tightly packet objects are less ideal. A 2D grid may not work well with a highly 3D environment. The octree method provides an alternative solution that avoids these problems.
The relationship between the inertia tensor and angular velocity is equivalent to the relationship between mass and linear velocity. The inertia tensor however, rotates with the object, where as mass is not affected by rotation.
The following code fragment demonstrates how inertia is used when applying an impulse to an object. All values, including that of m33InverseInertia
, are in world space.
v3LinearVelocity += v3Impulse * fInverseMass; v3AngularVelocity += v3WorldImpulse.Cross(v3CenterOfMass - v3PositionOfImpulse) * m33InverseInertia;
The octree implementation has a number of advantages over the collision grid implementation, but the collision grid method may often be faster. See collision grid for more information.
After a reference counted object is created it will have a reference count of one. AddRef()
and Release()
can be called to increment and decrement the reference count. If the reference count is zero after a call to Release()
the object will be automatically deleted. Reference counted objects should only be created using new.
The True Axis Physics SDK performs swept collision testing. By this we mean that all collision that occur during an objects movement can be found. As an approximation of reality, the True Axis Physics SDK finds all of the collisions that will occur in a time step and applies them all at ones. Multiple collisions passes are performed in a single time step to help cope with sudden velocity changes due to collisions. A single pass of this method of collision testing is slower than intersection testing but less passes are needed for accuracy so it can be potentially faster overall. Because swept collision testing is not need when object are moving slowly, it is turned off in these cases to improve execution speed.
The end result of the use of swept collision testing is that the True Axis Physics SDK copes well with very fast moving objects where other simulations have problems or even fail totally.