diff --git a/engine/src/bullet/com/jme3/bullet/PhysicsSpace.java b/engine/src/bullet/com/jme3/bullet/PhysicsSpace.java index 34d638536..2b6271aa1 100644 --- a/engine/src/bullet/com/jme3/bullet/PhysicsSpace.java +++ b/engine/src/bullet/com/jme3/bullet/PhysicsSpace.java @@ -703,12 +703,18 @@ public class PhysicsSpace { * @param gravity */ public void setGravity(Vector3f gravity) { -// dynamicsWorld.setGravity(Converter.convert(gravity)); + gravity.set(gravity); setGravity(physicsSpaceId, gravity); } private native void setGravity(long spaceId, Vector3f gravity); + //TODO: getGravity + private final Vector3f gravity = new Vector3f(0,-9.81f,0); + public Vector3f getGravity(Vector3f gravity) { + return gravity.set(this.gravity); + } + // /** // * applies gravity value to all objects // */ diff --git a/engine/src/jbullet/com/jme3/bullet/PhysicsSpace.java b/engine/src/jbullet/com/jme3/bullet/PhysicsSpace.java index 300b6eee5..484f52133 100644 --- a/engine/src/jbullet/com/jme3/bullet/PhysicsSpace.java +++ b/engine/src/jbullet/com/jme3/bullet/PhysicsSpace.java @@ -638,6 +638,16 @@ public class PhysicsSpace { dynamicsWorld.setGravity(Converter.convert(gravity)); } + /** + * Gets the gravity of the PhysicsSpace + * @param gravity + */ + public Vector3f getGravity(Vector3f gravity) { + javax.vecmath.Vector3f tempVec = new javax.vecmath.Vector3f(); + dynamicsWorld.getGravity(tempVec); + return Converter.convert(tempVec, gravity); + } + /** * applies gravity value to all objects */