NewtonCollisionCollideContinue

From Newton Wiki
Jump to: navigation, search

NewtonCollisionCollideContinue

int NewtonCollisionCollideContinue (const NewtonWorld* newtonWorld, int maxSize, const dFloat timestep, 
		const NewtonCollision* collisionA, const dFloat* matrixA, const dFloat* velocA, const dFloat* omegaA, 
		const NewtonCollision* collisionB, const dFloat* matrixB, const dFloat* velocB, const dFloat* omegaB, 
		dFloat* timeOfImpact, dFloat* contacts, dFloat* normals, dFloat* penetration, int threadIndex);

Usage

Calculate time of impact and contact points between two collision primitive.

Parameters

  • const NewtonWorld *newtonWorld - is the pointer to the Newton world.
  • int maxSize - size of maximum number of elements in contacts, normals, and penetration.
  • const dFloat timestep - maximum time interval consided for the continue collision claculation.
  • const NewtonCollision *collisionA - pointer to collision primitive A.
  • const dFloat *matrixA - pointer to an array of 16 floats containing the offset matrix of collision primitiveA.
  • const dFloat *velocA - pointer to and array of a least 3 times maxSize floats containing the linear velocity of collision primitiveA.
  • const dFloat *omegaA - pointer to and array of a least 3 times maxSize floats containing the angular velocity of collision primitiveA.
  • const NewtonCollision *collisionB - pointer to collision primitive B.
  • const dFloat *matrixB - pointer to an array of 16 floats containing the offset matrix of collision primitiveB.
  • const dFloat *velocB - pointer to and array of a least 3 times maxSize floats containing the linear velocity of collision primitiveB.
  • const dFloat *omegaB - pointer to and array of a least 3 times maxSize floats containing the angular velocity of collision primitiveB.
  • dFloat *timeOfImpact - pointer to least 1 float variable to contain the time of the intersection.
  • dFloat *contacts - pointer to and array of a least 3 times maxSize floats to contain the collision contact points.
  • dFloat *normals - pointer to and array of a least 3 times maxSize floats to contain the collision contact normals.
  • dFloat *penetration - pointer to and 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

  • by passing zero as maxSize not contact will be calculated and the function will just determine the time of impact is any.
  • if the body are interpenetrating the time of impact will be zero.
  • if the bodies do not collide time of impact will be set to timestep
  • 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

NewtonCollisionCollide NewtonCollisionClosestPoint NewtonCollisionPointDistance NewtonCollisionRayCast NewtonCollisionCalculateAABB