Regular API function

simRegisterContactCallback

Description Registers or unregisters a contact callback function for customized contact handling. Several plugins can register a callback, and the callbacks will be cascaded if not interrupted.
C synopsis simInt simRegisterContactCallback(simInt(*callBack)(simInt,simInt,simInt,simInt*,simFloat*))
C parameters
callback address. Specify the function you wish to register/unregister as callback. When the function is already registered, it will be unregistered. Following describes the callback's arguments:

first argument (int): handle of the first object that is involved in the contact. Could also be the handle of a dynamic particle
second argument (int): handle of the second object that is involved in the contact. Could also be the handle of a dynamic particle
third argument (int): the selected physics engine

The forth and fifth argument (allocated by V-REP) allow you to specify how the contact should behave (see also the respective Bullet, ODE, Newton and Vortex reference manuals):

forth argument (int*)
[0] should be set to zero (indicates the function version, for future extensions)
[1] Bullet, Newton and Vortex: not used (keep 0). ODE: contactCount (max. number of contact points to generate).
[2] Bullet, Newton and Vortex: not used (keep 0). ODE: contactMode (can be bit-wise combined):
1=dContactMu2
2=dContactFDir1
4=dContactBounce
8=dContactSoftERP
16=dContactSoftCFM
32=dContactMotion1
64=dContactMotion2
128=dContactSlip1
256=dContactSlip2
512=dContactApprox1_1
1024=dContactApprox1_2
2048=dContactApprox1
Fifth argument (float*)
[0] Bullet: combined friction. ODE: mu. Newton: combined static friction. Vortex: not used (keep0).
[1] Bullet: combined restitution. ODE: mu2. Newton: combined kinetic friction. Vortex: not used (keep0).
[2] Bullet: not used (keep 0.0). ODE: bounce. Newton: combined restitution. Vortex: not used (keep0).
[3] Bullet, Newton and Vortex: not used (keep 0.0). ODE: bounce_vel.
[4] Bullet, Newton and Vortex: not used (keep 0.0). ODE: soft_erp.
[5] Bullet, Newton and Vortex: not used (keep 0.0). ODE: soft_cfm.
[6] Bullet, Newton and Vortex: not used (keep 0.0). ODE: motion1.
[7] Bullet, Newton and Vortex: not used (keep 0.0). ODE: motion2.
[8] Bullet, Newton and Vortex: not used (keep 0.0). ODE: motionN.
[9] Bullet, Newton and Vortex: not used (keep 0.0). ODE: slip1.
[10] Bullet, Newton and Vortex: not used (keep 0.0). ODE: slip2.
[11] Bullet, Newton and Vortex: not used (keep 0.0). ODE: fdir1[0].
[12] Bullet, Newton and Vortex: not used (keep 0.0). ODE: fdir1[1].
[13] Bullet, Newton and Vortex: not used (keep 0.0). ODE: fdir1[2].

The callback return value can be:
-1: the callback doesn't process the contact and hands the contact to the next callback. If no callback processes it, the default contact handling is used
0: the contact is ignored and the two objects won't have a collision response
>0: the contact will be handled with above's values (the default values are overridden)
C return value
-1 if operation was not successful. 0 if the callback was unregistered, 1 if the callback was registered
Lua synopsis -
Lua parameters
-
Lua return values
-

All regular API functions on one page