# class neRigidBody

Properties | Spatial States | Dynamic States | Others
GetMass SetMass SetInertiaTensor SetCollisionID GetCollisionID SetUserData GetUserData SetForce SetTorque SetForce GetForce GetTorque | GetPos SetPos GetRotationM3 GetRotationQ SetRotation SetRotation GetTransform | GetVelocity SetVelocity GetAngularVelocity GetAngularMomentum SetAngularMomentum | UpdateBoundingInfo ApplyImpulse ApplyImpulse ApplyTwist GravityEnable GravityEnable CollideConnected CollideConnected Active Active Active GetGeometryCount AddGeometry RemoveGeometry BeginIterateGeometry GetNextGeometry BreakGeometry AddSensor RemoveSensor BeginIterateSensor GetNextSensor AddController RemoveController BeginIterateController GetNextController

f32 GetMass();
void SetMass(f32 mass);

Sets and retrieves the mass of the rigid body. This property governs how fast a rigid body will accelerate under a given force, as well as how big an impulse is needed to change the body's velocity.

void SetInertiaTensor(const neM3 & tensor);
void SetInertiaTensor(const neV3 & tensor);

Set and retrieve the body's mass inertia tensor. This property is analagous to mass, but effects the rotational behaviour. Use utility functions such as neBoxInertiaTensor to help you set this value.

<back to top>

void SetCollisionID(s32 cid);
s32 GetCollisionID();

Set and retrieve the collision ID of the rigid body. The collision ID, along with the neCollisionTable, determines how the rigid body will respond when a collision has occurred with other objects in the simulation. See also neCollisionTable.

<back to top>

void SetUserData(u32 userData);
u32 GetUserData();

Set and retrieve the user data property. This is a u32 value used to store game-specific information associated with the rigid body.

<back to top>

s32 GetGeometryCount();
neGeometry * AddGeometry();
neBool RemoveGeometry(neGeometry * g);
void BeginIterateGeometry();
neGeometry * GetNextGeometry();

Use these functions to create and retrieve neGeometry objects for the rigid body. The collection neGeometry belonging to a rigid body defines the body's collision boundary. It also defines the rigid body's breaking behaviour. A rigid body can also exist and be simulated without any neGeomtry assigned to it; it just won't collide with anything in the simulation. All neGeometry objects within a rigid body will be freed automatcally when the rigid body is freed. See also neGeometry.

<back to top>

neRigidBody * BreakGeometry(neGeometry * g);

Breaks off the geometry object, which must belong to the rigid body. Returns the newly created rigid body.

<back to top>

neSensor * AddSensor();
neBool RemoveSensor(neSensor * s);
void BeginIterateSensor();
neSensor * GetNextSensor();

Use these functions to create and retrieve neSensor objects for the rigid body. See neSensor.

<back to top>

neRigidBodyController * AddController(neRigidBodyControllerCallback * controller, s32 period);
neBool RemoveController(neRigidBodyController * rbController);
void BeginIterateController();
neRigidBodyController * GetNextController();

Use these functions to create and retrieve neRigidBodyController objects for the rigid body. See neRigidBodyController.

<back to top>

neV3 GetPos();
void SetPos(const neV3 & p);
neM3 GetRotationM3();
neQ GetRotationQ();
void SetRotation(const neM3 & m);
void SetRotation(const neQ & q);
neT3 GetTransform();

Set and retrieve spatial states for the rigid body with these functions.

<back to top>

neV3 GetVelocity();
void SetVelocity(const neV3 & v);
neV3 GetAngularVelocity();
neV3 GetAngularMomentum();
void SetAngularMomentum(const neV3& am);

Set and retrieve dynamic states for the rigid body with these functions.

<back to top>

void UpdateBoundingInfo();

Update the internal bounding information of the rigid body. Whenever the user changes the geometry and/or sensor of the rigid body by adding, removing, or modifying the geometry and/or sensor, this function needs to be called to update the internal bounding information.

<back to top>

void SetForce(const neV3 & force);
void SetTorque(const neV3 & torque);
void SetForce(const neV3 & force, const neV3 & pos);
neV3 GetForce();
neV3 GetTorque();

Set and retrieve the force/torque acting on the rigid body. A force will accelerate the rigid body's velocity. A torque will accelerate the rigid body's angular velocity. When the force is applied at a point other than the Center of Mass of the rigid body, it will also produce a torque, hence the second SetForce function, where pos is defined in world coordinates.

The force/torque will be apply continously. To apply no force/torque to the rigid body set the value to zero.

<back to top>

void ApplyImpulse(const neV3 & impulse);
void ApplyImpulse(const neV3 & impulse, const neV3 & pos);
void ApplyTwist(const neV3 & twist);

Apply an impulse or a twist to the rigid body. An impulse will produce a immediate change in velocity. A twist will produce immediate a change in angular velocity. An impulse applied at a point other than the Center of Mass of the rigid body also produce a twist. To do this, use the second ApplyImpulse function, where pos is define in world coordinates of the application point.

<back to top>

void GravityEnable(neBool yes);
neBool GravityEnable();

Enable or disable gravity for the rigid body. If gravity is enabled, the rigid body will have a force equal to

gravity x mass

automatically applied to it by the simulator.

<back to top>

void CollideConnected(neBool yes);
neBool CollideConnected();

Define whether or not a rigid body will collide with another body connected to it via joints (neJoint). The behaviour defined by this function overrides the behaviour defined by the neCollisionTable.

<back to top>

void Active(neBool yes, neRigidBody * hint = NULL);
void Active(neBool yes, neAnimatedBody * hint = NULL);
neBool Active();

Activate or deactivate the rigid body. When a rigid body is deactivated, the simulator will not update its dynamic state, will not call its controllers, and the rigid body will not collide with anything.

When activating (yes == true), an optional hint can be supplied. The hint should be a rigid body or an animated body near where the rigid body being activated is. This can help speed up the introduction of the newly-activated rigid body into the simulation.

<back to top>