1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| ProcedureC nearCallback(*donnes, o1.l, o2.l)
Define b1.l, b2.l, c.l, num.l
; récuperer les ID des body des géométrie en contact
b1 = ode_dGeomGetBody(o1)
b2 = ode_dGeomGetBody(o2)
; quitter la fonction si les 2 objet sont liés
If b1 & b2
If ode_dAreConnected(b1,b2)
ProcedureReturn 0
EndIf
EndIf
; définir le nombre de contact max
Define maxC.b = 10
Dim contact.contact(maxC-1)
For i=0 To maxC-1
contact(i)\surface\mode = #ode_dContactSoftCFM | #ode_dContactApprox1
contact(i)\surface\mu = 0.9
contact(i)\surface\soft_cfm = 0.2
Next i
; récupere le nombre de contact
num = ode_dCollide(o1, o2, maxC,@contact(), SizeOf(contact))
; si il y a contact
If num
For i = 0 To num-1
c = ode_dJointCreateContact (idW, 0, @contact() + i*SizeOf(contact))
ode_dJointAttach(c, b1, b2)
Next i
EndIf
EndProcedure |
Partager