[ODE] gravity per object?

Lukas Henschke henschke at 4head.de
Wed Mar 24 11:36:57 MST 2004


> I'm wanting to set a seperate gravity direction on each object....
> is this possible with ODE?

A simple way would be the following (not tested):

- get the global gravity (dWorldGetGravity)
- invert it
- for each object define a new gravity direction
- add the inverted gravity
- for each frame add a force (dBodyAddForce) with the components of the new
gravity vector

(desired gravity direction)   <----/\  (inverted gravity)
(force direction)                   |\     |
                                             \    |
                                              \   |
                                               \  |
                                                \ |
                                                 \|
                                                  |
                                                  |
                                                  |
                                                  |
                                                  |
                                                  |
                                                 \/ (global gravity)


More information about the ODE mailing list