NewtonCollisionCollide

From Newton Wiki
Jump to: navigation, search

NewtonCollisionCollide

int NewtonCollisionCollide (const NewtonWorld* const newtonWorld, int maxSize, const NewtonCollision* const collisionA, const dFloat* const matrixA, const NewtonCollision* const collisionB, const dFloat* const matrixB, dFloat* const contacts, dFloat* const normals, dFloat* const penetration, dLong* const attributeA, dLong* const attributeB, int threadIndex)

Usage

Calculate contact points between two collision primitive.

Parameters

  • const NewtonWorld* const newtonWorld - is the pointer to the Newton world.
  • int maxSize - size of maximum number of elements in contacts, normals, and penetration.
  • const NewtonCollision* const collisionA - pointer to collision primitive A.
  • const dFloat* const matrixA - pointer to the first element of an array of 16 floats containing the offset matrix of collision primitiveA.
  • const NewtonCollision* const collisionB - pointer to collision primitive B.
  • const dFloat* const matrixB - pointer to the first element of an array of 16 floats containing the offset matrix of collision primitiveB.
  • dFloat* const contacts - pointer to the first element of an array of a least 3 times maxSize floats to contain the collision contact points.
  • dFloat* const normals - pointer to the first element of an array of a least 3 times maxSize floats to contain the collision contact normals.
  • dFloat* const penetration - pointer to the first element of an array of a least maxSize floats to contain the collision penetration at each contact.
  • dLong* const attributeA
  • dLong* const attributeB
  • int threadIndex

Return

  • the number of contact points.

Remarks

  • This function can be used as a low-level building block for a stand-alone collision system. Applications that have already there own physics system, and only want and quick and fast collision solution, can use Newton advanced collision engine as the low level collision detection part. To do this the application only needs to initialize Newton, create the collision primitives at application discretion, and just call this function when the objects are in close proximity. Applications using Newton as a collision system only, are responsible for implementing their own broad phase collision determination, based on any high level tree structure. Also the application should implement their own trivial aabb test, before calling this function .

See also

NewtonCollisionCollideContinue NewtonCollisionClosestPoint NewtonCollisionPointDistance NewtonCollisionRayCast NewtonCollisionCalculateAABB