[ODE] Contact joint MotionN
Geoff Carlton
gcarlton at iinet.net.au
Thu Jan 6 14:24:02 MST 2005
I've added a new feature to the contact joint to handle object-world
collisions where the world is moving. In my case, I have a lift trimesh
that has no body, but does have a velocity. To allow this, I've added a
MotionN field to the contact enum that allows the contact to incorporate
a velocity along the collision normal (in a similar way to the existing
Motion1/Motion2 along the other 2 directions).
I haven't got around to a patch file yet since my ode has diverged a bit
(I've also added the PosR change for offset bodies that was discussed
previously), however the code is very simple.
The enum in contact.h:
dContactSlip2 = 0x100,
dContactMotionN = 0x200,
dContactApprox0 = 0x0000,
The contactGetInto2 in joint.cpp:
Calculate motion:
dReal motionN = 0;
if (j->contact.surface.mode & dContactMotionN)
{
motionN = j->contact.surface.motionN;
}
Then we apply it to our 'c':
dReal pushout = k*depth + motionN;
if (pushout > maxvel) info->c[0] = maxvel; else info->c[0] = pushout;
Bounce is changed to the following:
dReal newc = - j->contact.surface.bounce * outgoing + motionN;
if (newc > info->c[0]) info->c[0] = newc;
I'll make up a patch file if anybody is interested (or I get bored and
want something to do).
Geoff
More information about the ODE
mailing list