NewtonCreateCapsule

From Newton Wiki
Jump to: navigation, search

NewtonCreateCapsule

Syntax:

NewtonCollision* NewtonCreateCapsule( const NewtonWorld* newtonWorld, dFloat radius, dFloat height, int shapeID, const dFloat *offsetMatrix)

Usage

Creates a capsule primitive for collision.

Parameters

  • const NewtonWorld *newtonWorld - is the pointer to the Newton world.
  • dFloat radius - capsule radius at the base.
  • dFloat height - capsule height along the x local axis from tip to tip.
  • int shapeID - custom ID to associate with the collision shape.
  • const dFloat *offsetMatrix - pointer to an array of 16 floats containing the offset matrix of the box relative to the body. If this parameter is NULL, then the primitive is centered at the origin of the body.

Return

  • pointer to the capsule object.

Remarks

  • The capsule height must greater than or equal to the sum of the cap radii. If this is not the case the height will be clamped to 2 * radius.
  • Collision primitives are reference counted objects. The application should call NewtonReleaseCollision in order to release references to the object. Neglecting to release references to collision primitives is a common cause of memory leaks. Collision primitives can be reused with more than one body. This will reduce the amount of memory used be the engine, as well as speed up some calculations.

See also

NewtonReleaseCollisionNewtonCreateConvexHullModifier Newton SDK API reference#Category:convex_collision_primitives_creation_functions