- add gravity getter for physicsspace
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10357 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
eb28a66f6f
commit
9603b6d09b
@ -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
|
||||
// */
|
||||
|
@ -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
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user