[ODE] Sphere pass through box, mass problem
Vrej Melkonian
vmelkon at yahoo.com
Sun Nov 13 18:55:26 MST 2005
Is this the change that should be made?
This is in collision_util.cpp
In function dClosestLineBoxPoints
I changed the coding format because this is what I'm
used to.
The sphere still falls through the box.
I don't have file memory.h in /ode/include/ode/
collision_transform.cpp doesn't need to be changed.
Thanks
//////////////////CODE////////////////////////
// find the region and tanchor values for p1
for(i=0; i<3; i++)
{
if (v[i] > 0)
{
// Denormals are a problem, because we divide by
v[i], and then
// multiply that by 0. Alas, infinity times 0 is
infinity (!)
// We also use v2[i], which is v[i] squared.
Here's how the epsilons
// are chosen:
// float epsilon = 1.175494e-038 (smallest
non-denormal number)
// double epsilon = 2.225074e-308 (smallest
non-denormal number)
// For single precision, choose an epsilon such
that v[i] squared is
// not a denormal; this is for performance.
// For double precision, choose an epsilon such
that v[i] is not a
// denormal; this is for correctness.
#if defined dSINGLE
if (v[i] > dReal(1e-19))
#else
if (v[i] > dReal(1e-307))
#endif
{
if (s[i] < -h[i])
{
region[i] = -1;
tanchor[i] = (-h[i]-s[i])/v[i];
}
else
{
region[i] = (s[i] > h[i]);
tanchor[i] = (h[i]-s[i])/v[i];
}
}
}
else
{
region[i] = 0;
tanchor[i] = 2; // this will never be a valid
tanchor
}
}
--- Jon Watte <hplus at mindcontrol.org> wrote:
>
> There's a problem where spheres and ccylinders may
> be able to push
> through boxes, because there's a division by a
> denormal number somewhere
> in the pipe. I submitted a patch for this problem
> over a year ago, but
> it was rejected because I had coded the specific
> floating point
> constants for denormals, instead of using some other
> supposedly better
> method (the specifics of which were never actually
> submitted to the list).
>
> You want the diff from 040426 from here:
>
> http://www.mindcontrol.org/~hplus/ode/diffs.html
>
> Cheers,
>
> / h+
>
>
> Vrej Melkonian wrote:
> > Hi,
> >
> > I have a ODE box object that makes up the floor of
> my
> > room.
> > Actually, there are many but the sphere is resting
> on
> > one.
> > The floor is static in my world.
> >
> > The ODE sphere is a moveable entity.
> > It appears that if the mass is to high (4.5 as
> > calculated by dMassSetSphere, density == 1.0)
> > the sphere slowly goes through the floor.
> > If the mass is 0.45 (10x lighter, density == 0.1),
> I
> > think it doesn't, which is the behavior I want.
> >
> > I also have boxes in my room (moveable object) and
> > these are relatively heavy as well (density ==
> 1.0)
> > but these don't go through the floor.
> >
> > What's the story?
> >
> > Vrej
> >
> >
> >
> >
> > __________________________________
> > Yahoo! Mail - PC Magazine Editors' Choice 2005
> > http://mail.yahoo.com
> > _______________________________________________
> > ODE mailing list
> > ODE at q12.org
> > http://q12.org/mailman/listinfo/ode
> >
> >
>
> --
> -- The early bird gets the worm, but the second
> mouse gets the cheese.
>
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
More information about the ODE
mailing list