JointUpVector

NewtonJoint *NewtonConstraintCreateUpVector(const NewtonWorld *const newtonWorld, const dFloat *pinDir, const NewtonBody *const body)

Create a UpVector joint.

This function creates an up vector joint. An up vector joint is a constraint that allows a body to translate freely in 3d space, but it only allows the body to rotate around the pin direction vector. This could be use by the application to control a character with physics and collision.

Return
Pointer to the up vector joint.
Parameters
  • *newtonWorld: Pointer to the Newton world.
  • *pinDir: is the aligning vector.
  • *body: is the pointer to the attached rigid body, this body can not be NULL or it can not have an infinity (zero) mass.

Since the UpVector joint is a unary constraint, there is not need to have user callback or user data assigned to it. The application can simple hold to the joint handle and update the pin on the force callback function of the rigid body owning the joint.

void NewtonUpVectorGetPin(const NewtonJoint *const upVector, dFloat *pin)

Get the up vector pin of this joint in global space.

the application ca call this function to read the up vector, this is useful to animate the up vector. if the application is going to animated the up vector, it must do so by applying only small rotation, too large rotation can cause vibration of the joint.

Return
nothing.
Parameters
  • *upVector: pointer to the joint.
  • *pin: pointer to an array of a least three floats to hold the up vector direction in global space.

See also: NewtonUpVectorSetPin

void NewtonUpVectorSetPin(const NewtonJoint *const upVector, const dFloat *pin)

Set the up vector pin of this joint in global space.

the application ca call this function to change the joint up vector, this is useful to animate the up vector. if the application is going to animated the up vector, it must do so by applying only small rotation, too large rotation can cause vibration of the joint.

Return
nothing.
Parameters
  • *upVector: pointer to the joint.
  • *pin: pointer to an array of a least three floats containing the up vector direction in global space.

See also: NewtonUpVectorGetPin