[ODE] Interesting... quirks
Hampus
hampus at sxp.se
Mon Jul 17 19:12:20 MST 2006
Hi Wesley,
18 jul 2006 kl. 06.48 skrev Wesley Paugh:
> I'm getting the hang of ODE basics, but I'm encountering some very
> odd errors and I'm not sure what is going wrong. Collision
> detection has not been smooth sailing, by any means.
>
> For instance, when creating a group of contact joints, the line
>
> int numC = dCollide(*leftBox, *rightBox, 1, contactGroup, (int)
> sizeof(dContactGeom));
that should be sizeof(dContact)
How have you declared your contactGroup, leftBox, rightBox? Is this
from nearCallback?
If you only want to see if two objects collide your code should look
something like this:
dContactGeom contact;
dGeomID box1, box2;
c = dCollide(box1, box2, 0, &contact, sizeof(dContact);
>
> always fails, with the error
>
> Assertion "skip >= (int)sizeof(dContactGeom));" Box.xpp
>
> This almost seems impossible. I've been runnning the simulation
> with 2 * (int)sizeof(dContactGeom), and it works fine, but it is
> difficult to see what long-term effects such a hack might have.
>
> Another question regards the Plane geometry. The manual has
> indicated that to set a plane's position you set its parameters a,
> b, and c such that a*x + b*y + c*z gives a unit vector in the
> direction you wish the plane to face, and then give d to be the
> distance from the global origin the plane is along the vector
> specified by a, b, and c. Is that accurate?
>
> dMass has also given me some confusion. I understand how to set the
> center of mass, but am unclear as to the purpose of the 3x3 matrix
> that also needs to be set, and am currently setting all values to 0.
That is the rotation of the mass I think.
You should use the helper functions to set mass (dMassSetBoxTotal
etc). Setting 0 or a very low mass can give you instability problems
with objects spinning out of control.
>
> I do not know when to call dJointGroupEmpty(). I apologize for
> asking as I know I have read the answer somewhere but I cannot seem
> to find it again.
call It after each worldStep();
Something like this:
dSpaceCollidee();
dWorldStep()
dJointGroupEmpty()l
>
> Finally, dSpaceCollide does not work as promised. I call it, giving
> it a parameter of the space in which three objects exist, a null
> pointer and a reference to a function copy and pasted from what has
> worked to give me the brief 2-object collisions that almost work
> above. However, calling this function ensures that none of the
> objects collide.
>
> The ultimate problem I am encountering is that objects exhibit
> random behaviors on collision. Sometimes they bounce as expected
> (never colliding with the plane, however), Sometimes they collide
> and double in velocity. Sometimes they disappear almost instantly.
> I don't have an explanation for any of it, most of all why no two
> runs are ever the same.
Please fix your dCollide function first.
>
> Any help with any of these question would be appreciated.
Regards,
Hampa
Toribash.com
>
>
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode
>
More information about the ODE
mailing list