NewtonCreateTreeCollision

From Newton Wiki
Jump to: navigation, search

NewtonCreateTreeCollision

NewtonCollision* NewtonCreateTreeCollision (const NewtonWorld* newtonWorld, int shapeID);

Usage

Create an empty complex collision geometry tree.

Parameters

  • const NewtonWorld *newtonWorld - is the pointer to the Newton world.
  • int shapeID - custom ID to associate with the collision shape.

Return

  • Pointer to the collision tree.

Remarks

  • TreeCollision is the preferred method within Newton for collision with polygonal meshes of arbitrary complexity. The mesh must be made of flat non-intersecting polygons, but they do not explicitly need to be triangles. TreeCollision can be serialized by the application to/from an arbitrary storage device.
  • When a TreeCollision is assigned to a body the mass of the body is ignored in all dynamics calculations. This makes the body behave as a static body.
  • 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 by the engine, as well as speed up some calculations.

See also

NewtonTreeCollisionBeginBuild NewtonTreeCollisionAddFace NewtonTreeCollisionEndBuild NewtonTreeCollisionSerialize NewtonCreateTreeCollisionFromSerialization NewtonTreeCollisionGetFaceAtribute NewtonTreeCollisionSetFaceAtribute NewtonReleaseCollision