# class neJoint

Joint Types | Joint Frame and Limit | Others
SetType GetType GetRigidBodyA GetRigidBodyB GetAnimatedBodyB Enable Enable | SetJointFrameA GetJointFrameA SetJointFrameB GetJointFrameB SetJointFrameWorld SetJointLength GetJointLength EnableLimit EnableLimit2 GetLowerLimit SetLowerLimit GetUpperLimit SetUpperLimit | SetEpsilon GetEpsilon SetIteration GetIteration AddController RemoveController BeginIterateController GetNextController

typedef enum
{
NE_JOINT_BALLSOCKET,
NE_JOINT_HINGE,
}JointType;

void SetType(JointType t);
JointType GetType();

Specify and retrieve the type of the joint.

<back to top>

neRigidBody * GetRigidBodyA();
neRigidBody * GetRigidBodyB();
neAnimatedBody * GetAnimatedBodyB();

Retrieve the bodies which are connected by this joint. The bodies are specified when the joint is created and cannot be changed.

<back to top>

void SetJointFrameA(const neT3 & frameA);
void SetJointFrameB(const neT3 & frameB);
neT3 GetJointFrameA();
neT3 GetJointFrameB();

Use these functions to specify and retrieve the reference frame of the joint. The reference frame of the joint specifies position and orientation of the joint with respect to each body's local frame. For ball-and-socket joints, the position of the frame specifies the location where the two bodies are connected. For hinge joints, the position specifies the location of the joint, and the Y-axis of the joint frame is the axis of the joint (which is the axis the two bodies are free to rotate about).

<back to top>

void SetJointFrameWorld(const neT3 & frame);

Use this function to specify the joint's frame in world coordinate. To use this function, typically the two bodies of the joint would already be positioned correctly in relation to each other in world co-ordinates.

<back to top>

void SetJointLength(f32 length);
f32 GetJointLength();

Specify and retrieve the length of the joint. Some joints, such as hinge joints, have length as well as position and orientation.

<back to top>

void Enable(neBool yes);
neBool Enable();

Enable or disable the joint. The second function returns true if the joint is enabled.

<back to top>

void EnableLimit(neBool yes);
neBool EnableLimit();
void EnableLimit2(neBool yes);
neBool EnableLimit2();

Enable or disable the joint limit. The second function returns true if the joint limit is enabled. The last two functions relate to the second limit for the joint. Note: currently, only ball and socket joints have a second limit, which is the twist.

<back to top>

f32 GetUpperLimit();
void SetUpperLimit(f32 upperLimit);
f32 GetLowerLimit();
void SetLowerLimit(f32 lowerLimit);
f32 GetUpperLimit2();
void SetUpperLimit2(f32 upperLimit);
f32 GetLowerLimit2();
void SetLowerLimit2(f32 lowerLimit);

Set the upper and lower limits of the joint. Joint limits are used to restrict the movement of a joint. For ball-and-socket joints and hinge joints, the joint's current angle is the angle between the X-axes of the joint's frame in each of the joint bodies. For ball-and-socket joints, the valid range of the lower limit is 0 to PI; for the upper limit, between lower the limit and PI. For a hinge joint, the valid range for lower and upper limits is -PI..PI, but the upper limit must be greater than the lower limit.

For ball and socket joints, a twist limit can also be specified. This is done by calling the SetUpperLimit2 and SetLowerLimit2 functions.

<back to top>

void SetEpsilon(f32 e);
f32 GetEpsilon();
void SetIteration(s32 i);
s32 GetIteration();

These functions relate to the accuracy of the solution of the joint. Generally, lower accuracy results in faster simulation, but may be prone to side effects if the accuracy is too low. Epsilon specifies the early-exit theshold for the constraint solver. Iteration relates to the number of iterations the solver will use to solve the constraint. Setting the epsilon to 0 means the solver will always perform the specified number of iterations and will not exit early.

<back to top>

neJointController * AddController(neJointControllerCallback * controller, s32 period);
neBool RemoveController(neJointController * rbController);
void BeginIterateController();
neJointController * GetNextController();

These functions provide access to adding and removing joint controller callbacks.

<back to top>