[ODE] dJointCreateContact
David Whittaker
david at csworkbench.com
Thu Apr 10 17:14:16 2003
The whole contact joint structure looks like this:
struct dSurfaceParameters {
/* must always be defined */
int mode;
dReal mu;
/* only defined if the corresponding flag is set in mode */
dReal mu2;
dReal bounce;
dReal bounce_vel;
dReal soft_erp;
dReal soft_cfm;
dReal motion1,motion2;
dReal slip1,slip2;
};
struct dContactGeom {
dVector3 pos; // contact position
dVector3 normal; // normal vector
dReal depth; // penetration depth
dGeomID g1,g2; // the colliding geoms
};
struct dContact {
dSurfaceParameters surface;
dContactGeom geom;
dVector3 fdir1;
};
It sounds like you've got the surface stuff taken care of, so that leaves
the geom stuff. It also sounds like you have the pos, normal, and depth
stuff under wraps (yes, ODE does need this information to resolve
collisions). So all you have left to fill in is g1 and g2. If you have
read through section 9.11.2 in the docs, you should have redefined the
dGeomID class/struct to represent an object in your collision detection
scheme (it's typedef'd as a dxGeom* in ODE's CD code, I beleive). So just
put the pointers (or other type... it could be an int for an index in an
array for all ODE cares) to the colliding objects in g1 and g2 and you're
done.
> Hi
>
> Question for the join experts.
> I am not using the built in collision detection stuff. So I need to
> create my own dContact data for the contact joint creation. The docs
> say that this data is created bt the collision detection dCollied()
> function. I fill in the surface stuff but there is a geom structure that
> holds pos, depth an normal that dCollied supplies. I can fill this too,
> but it looks to me like there's some other stuff in there (pointers to
> pos and rotation matrix etc). Can anyone tell me how much of this
> dContact data is needed by the contact joint at creation time.
>
> Brian..