[ODE] [Odejava] My box refuses to tip over!

Nik Unger tarhspam at gmail.com
Tue May 15 18:04:00 MST 2007


I'm currently accessing ODE through Odejava's low level API (so calls are
one-to-one, therefore shouldn't be that much of a translation issue).  I'm
currently dropping boxes into an environment consisting of an open box
(floor and four walls).  These are Geoms placed in the environment with no
body.  This is actually a dice rolling simulation, so the boxes are dice.

As the boxes roll, however, they sometimes stop on their edges instead of
their faces, as if they simply refuse to tip all the way over.  Sometimes
they land on their faces, but this is about 25% of the time.

Here's how I create each box and assign it's mass:

            this.myBodyID = Ode.dBodyCreate(dice.worldId);
            Ode.dBodySetPosition(this.myBodyID, 0f, 0f, 0f);
            this.myMass = new dMass();
            Ode.dMassSetBox(this.myMass.getCPtr(), 1f, die.DIAMETER * 2,
die.DIAMETER * 2, die.DIAMETER * 2);
            Ode.dMassAdjust(this.myMass.getCPtr(), 1f);
            Ode.dBodySetMass(this.myBodyID, this.myMass.getCPtr ());
            this.myGeomID = Ode.dCreateBox(dice.spaceId, die.DIAMETER * 2,
die.DIAMETER * 2, die.DIAMETER * 2);
            Ode.dGeomSetBody(this.myGeomID, this.myBodyID);
            Ode.dBodySetAutoDisableFlag (this.myBodyID, 0);

What am I doing wrong?

Thanks for any help, more code is available if needed.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ode.org/pipermail/ode/attachments/20070515/a7cb1d90/attachment.htm

More information about the ODE mailing list