Is JMonkey gravity a direction or a location?

Say you wanted to simulate a moon orbiting a planet using JMonkey’s ultracool physics engine :slight_smile:



Now, when I’ve been modding the demos in the jme3test collection, for instance adding a sphere (for a planet) to the TestPhysicsCar app and globally changing the gravity vector3f of the physicsspace to what I thought was the center of the planet (0.0f, -planetradius.0f, 0.0f), the car rolls down the hill and falls off the sphere. I was hoping to drive round the sphere :frowning: and I’m sure i can be done somehow.



Any pointers / clarification much appreciated!

Going off memory here, but I think gravity is defined as a force applied down on the Y axis.



I remember someone asking something similar to this months ago. Search the forum using the google search bar.

2 Likes
Is JMonkey gravity a direction or a location?


i suppose if there is a vector then it is direction, not location.

I was hoping to drive round the sphere and I’m sure i can be done somehow.


so you can always change gravity direction to location direction. (if it is direction - i dont use physics actually)
1 Like

Found the earlier thread, cheers!



http://hub.jmonkeyengine.org/groups/physics/forum/topic/point-gravity-black-hole-gravity-source/

1 Like

Wouldn’t changing gravity direction mean that different objects fell in the wrong directions though?



i.e.



ob (w) me



if gravity is set to pull me towards (w) wont ob fly away into space?



In this case wouldn’t gravity direction need to be calculated separately for every object?

you set it per-object

1 Like

If I’m not mistaken, you can set it in a PhysicsSpace also, so when an object is attach to the space, it’s local gravity will be the same as the PhysicsSpace.

1 Like