static neSimulator
* CreateSimulator(const
neSimulatorSizeInfo & sizeInfo,
neAllocatorAbstract * alloc
= NULL,
const neV3 * gravity
= NULL);
static void DestroySimulator(neSimulator * sim);
Use CreateSimulator to create a new instance of the simulator.
sizeInfo specifies the amount of various objects to allocate within the simulator.
alloc is a user-supplied memory allocator object. Supply your own allocator object base on the neAllocatorAbstract class. Supplying NULL tells the simulator to use the default allocator object which uses the standard malloc and free functions.
Use DestroySimulator to delete an existing instance of the simulator object.
See also neSimulatorSizeInfo, neAllocatorAbstract.
neRigidBody * CreateRigidBody();
neRigidBody * CreateRigidParticle();
neAnimatedBody * CreateAnimatedBody();
void FreeRigidBody(neRigidBody
* body);
void FreeAnimatedBody(neAnimatedBody
* body);
Use these functions to create or free a rigid body (neRigidBody), rigid particle (neRigidBody), or animated body (neAnimatedBody).
See also neRigidBody, neAnimatedBody.
neCollisionTable * GetCollisionTable();
Retrieve the pointer to the collision table. A collision table specifies the collision response between different collision groups inside the simulation.
See also neCollisionTable
bool SetMaterial(s32
index, f32 friction,
f32 restitution);
bool GetMaterial(s32
index, f32& friction,
f32& restitution);
Specify and retrieve the material properties for a corresponding material index.
By default all materials have the following values:
friction = 0.4
restitution = 0.5
void Advance(f32 sec, s32 nSteps = 1, nePerformanceReport * perfReport = NULL);
Advance the simulation by the amount sec, specified in milliseconds. nSteps specifies the number of sub-steps to perform.
perfReport, if supplied, would be filled with the simulator's performance information during this time step.
See also nePerformanceReport
void SetTerrainMesh(neTriangleMesh * tris);
Use this function to specify the terrain mesh to the simulator.
See also neTriangleMesh
neJoint * CreateJoint(neRigidBody
* bodyA);
neJoint * CreateJoint(neRigidBody
* bodyA, neRigidBody *
bodyB);
neJoint * CreateJoint(neRigidBody
* bodyA, neAnimatedBody
* bodyB);
void FreeJoint(neJoint
* joint);
Create and free joint a object. The first form of CreateJoint takes one neRigidBody. This means the joint constraint of the rigid body to the world. The second and third form require a joint which constrains bodyA to another rigid body or to an animated body respectively.
When a rigid body or animated body is freed, all their associated joints, geometries, sensors and callbacks are freed automatically.
See also neJoint
void SetBreakageCallback(neBreakageCallback
* cb);
neBreakageCallback * GetBreakageCallback();
Specify and retrieve the breakage callback function. The breakage callback function is called by the simulator whenever a breakage is about to occur. The callback function is called for each geometry object which has broken. When the geometry is broken, a new rigid body (or rigid particle, depending the breakage flag) is spawned. During the breakage callback function the application can retrieve the pointer to the newly spawned object.
See also neBreakageCallback
void SetCollisionCallback(neCollisionCallback
* cb);
neCollisionCallback * GetCollisionCallback();
Specify and retrieve the collision callback function. The collision callback function returns information about a collision between two objects in the simulation. Each pair of objects will only receive a maximum of one collision callback for each timestep of the simulation.
See also neCollisionCallback
void SetTerrainTriangleQueryCallback(neTerrainTriangleQueryCallback
* cb);
neTerrainTriangleQueryCallback * GetTerrainTriangleQueryCallback();
void SetLogOutputCallback(neLogOutputCallback
* cb);
neLogOutputCallback * GetLogOutputCallback();
void SetLogOutputLevel(LOG_OUTPUT_LEVEL
lvl = LOG_OUTPUT_LEVEL_FULL);
neSimulatorSizeInfo GetCurrentSizeInfo();
neSimulatorSizeInfo GetStartSizeInfo();
See also neSimulatorSizeInfo
void GetMemoryAllocated(s32 & memoryAllocated);