NewtonCreateUserMeshCollision

From Newton Wiki
Revision as of 09:47, 3 October 2019 by WikiSysop (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

NewtonCreateUserMeshCollision

NewtonCollision* NewtonCreateUserMeshCollision (const NewtonWorld* newtonWorld, const dFloat *minBox, 
	const dFloat *maxBox, void *userData, NewtonUserMeshCollisionCollideCallback collideCallback, 
	NewtonUserMeshCollisionRayHitCallback rayHitCallback, NewtonUserMeshCollisionDestroyCallback destroyCallback,
	NewtonUserMeshCollisionGetCollisionInfo getInfoCallback, NewtonUserMeshCollisionGetFacesInAABB facesInAABBCallback);

Usage

Create a complex collision geometry to be controlled by the application.

Parameters

  • const NewtonWorld *newtonWorld - is the pointer to the Newton world.
  • const dFloat *minBox - pointer to the first element of an array of at least three floats to hold minimum value for the box relative to the collision.
  • const dFloat *maxBox - pointer to the first element of an array of at least three floats to hold maximum value for the box relative to the collision.
  • void *userData - pointer to user data to be used as context for event callback.
  • NewtonUserMeshCollisionCollideCallback collideCallback - pointer to an event function for providing Newton with the polygon inside a given box region.
  • NewtonUserMeshCollisionRayHitCallback rayHitCallBack - pointer to an event function for providing Newton with ray intersection information.
  • NewtonUserMeshCollisionDestroyCallback destroyCallback - pointer to an event function for destroying any data allocated for use by the application, can be NULL.
  • NewtonUserMeshCollisionGetCollisionInfo getInfoCallback - pointer to an event function for querying collision information.
  • NewtonUserMeshCollisionAABBTest getLocalAABBCallback
  • NewtonUserMeshCollisionGetFacesInAABB facesInAABBCallback - pointer to an event function for retreiving faces in collision's AABB.
  • NewtonOnUserCollisionSerializationCallback serializeCallback
  • int shapeID

Return

  • Pointer to the user collision.

Remarks

  • UserMeshCollision provides the application with a method of overloading the built-in collision system for background objects. UserMeshCollision can be used for implementing collisions with height maps, collisions with BSP, and any other collision structure the application supports and wishes to preserve. However, UserMeshCollision can not take advantage of the efficient and sophisticated algorithms and data structures of the built-in TreeCollision. We suggest you experiment with both methods and use the method best suited to your situation.
  • When a UserMeshCollision is assigned to a body, the mass of the body is ignored in all dynamics calculations. This make 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 be the engine, as well as speed up some calculations.

See also

NewtonReleaseCollision