Difference between revisions of "NewtonContactBegin"

From Newton Wiki
Jump to: navigation, search
m (1 revision imported)
(No difference)

Latest revision as of 08:02, 10 June 2019

typedef int (_cdecl *NewtonContactBegin) (const NewtonMaterial* material, const NewtonBody* body0, const NewtonBody* body1);

This callback is passed to NewtonMaterialSetCollisionCallback. It is called always, when axis-oriented bounding boxes(AABB) of two bodies with appropriate materials intersect. You can then decide wheter you want to process such collision further(return 1), or reject it at this early stage(return 0). If you accept collision, then NewtonContactProcess will be called for each contact generated. in versions earlier than newton 2.0 Remeber to save colliding bodies for further processing, as in NewtonContactProcess you won't know them! )

Example of callback:

   struct COLLISION
       const NewtonBody *colBody0, *colBody1;
   } g_col;
   int  _cdecl beginCallback(const NewtonMaterial* material, const NewtonBody* body0, const NewtonBody* body1)
       g_col.colBody0 = body0;
       g_col.colBody1 = body1;
       return 1;

See also: NewtonContactProcess NewtonContactEnd NewtonMaterialSetCollisionCallback

'Notes:' Replaced with NewtonOnAABBOverlap in Newton Archimedea