int NewtonWorldConvexCast (const NewtonWorld* const newtonWorld, const dFloat* const matrix, const dFloat* const target, const NewtonCollision* const shape, dFloat* const param, void* const userData, NewtonWorldRayPrefilterCallback prefilter, NewtonWorldConvexCastReturnInfo* const info, int maxContactsCount, int threadIndex)
Projects a collision shape from matrix origin towards a target returning all hits that the geometry would produce.
- const NewtonWorld *newtonWorld - is the pointer to the world.
- const dFloat* matrix - Starting position and orientation of the shape in global space
- const dFloat* target - Destination of the casted object in global space (convex cast does not support rotations).
- const NewtonCollision* shape - Collision shape to use for casting
- dFloat* hitParam
- void* userData
- NewtonWorldRayPrefilterCallback filter - user defined function to be called when the projected body hits the AABB of the body (potentional hit), can be used to tell newton to ignore bodies before checking weither they actually intresect with the object.
- NewtonWorldConvexCastReturnInfo* info - returns array of NewtonWorldConvexCastReturnInfo structures
- int maxContactsCount - number of NewtonWorldConvexCastReturnInfo structures that info pointer can return, newton will not return more contacts than this number, make sure you have allocated sufficient memory for contact results.
- int threadIndex
Object casting is a very useful feature, usually used for game AI such as scanning the world for presence of obstacles, for determining car tire ground contact shape, or character controller ground geometry.
- The objectcast function is provided as an utility function, this means that even thought the function is very high performance by function standards, it can not by batched and therefore it can not be an incremental function. For example the cost of calling 1000 object casts is 1000 times the cost of calling one object cast. This is much different than the collision system where the cost of calculating collision for 1000 pairs in much, much less that the 1000 times the cost of one pair. Therefore this function must be used with care, as excessive use of it can degrade performance.