Re: [ode-users] How to work with different units.

24 views
Skip to first unread message

Danny Chapman

unread,
Jun 28, 2023, 6:52:41 AM6/28/23
to ode-...@googlegroups.com
On Tue, 27 Jun 2023 at 20:11, Alphenex <alphe...@gmail.com> wrote:
I am working on a project with someone and we have rendering setup.
When we try to render an object using dBodyGetPosition(), it renders it in the wrong place. To make it render in the correct place we HAVE TO multiply the position by 2.

Try setting an object position in ODE to (1, 2, 3), and then immediately get its position. It will return (1, 2, 3), which should convince you ODE doesn't have a hidden scaling problem. It just works with what you give it.

ODE is unitless - it just deals with numbers. You decide what units you want to use, and so long as you're consistent, ODE doesn't care/know. By consistent I mean - if you use cm for your distance unit (when setting positions), and seconds for your time unit (when stepping the simulation), then you'd better use/expect to see velocities in cm/s if you ever set/read the velocity in/from ODE.

It's much more likely that the problem is either on the rendering, or model import side. Both of these will probably support scaling, which has plenty of potential for bugs or misunderstandings.

Cheers - Danny

--

Vaillancourt

unread,
Jun 28, 2023, 9:59:34 AM6/28/23
to ode-users
Hello!

For some reason the original message doesn't appear in the google groups' list..

AFAIK, when getting the position of an object, the value returned from dBodyGetPosition corresponds to the centre of mass of the body. If you have added multiple masses to the body, which makes the centre of mass not at its local 0, 0, 0 w.r.t. what you have on your graphics side, you may need to compute the difference between the physics centre and the graphics centre, then before drawing, apply a local translation to your graphics object and displace it based on this offset. 

I hope it helps,

- Vaillancourt
Reply all
Reply to author
Forward
0 new messages