|
|
|
@ -627,16 +627,44 @@ public class PhysicsRigidBody extends PhysicsCollisionObject { |
|
|
|
|
private native float getAngularSleepingThreshold(long objectId); |
|
|
|
|
|
|
|
|
|
public float getAngularFactor() { |
|
|
|
|
return getAngularFactor(objectId); |
|
|
|
|
return getAngularFactor(null).getX(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private native float getAngularFactor(long objectId); |
|
|
|
|
public Vector3f getAngularFactor(Vector3f store) { |
|
|
|
|
// doing like this prevent from breaking the API
|
|
|
|
|
if (store == null) { |
|
|
|
|
store = new Vector3f(); |
|
|
|
|
} |
|
|
|
|
getAngularFactor(objectId, store); |
|
|
|
|
return store; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private native void getAngularFactor(long objectId, Vector3f vec); |
|
|
|
|
|
|
|
|
|
public void setAngularFactor(float factor) { |
|
|
|
|
setAngularFactor(objectId, factor); |
|
|
|
|
setAngularFactor(objectId, new Vector3f(factor, factor, factor)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void setAngularFactor(Vector3f factor) { |
|
|
|
|
setAngularFactor(objectId, factor); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private native void setAngularFactor(long objectId, Vector3f factor); |
|
|
|
|
|
|
|
|
|
public Vector3f getLinearFactor() { |
|
|
|
|
Vector3f vec = new Vector3f(); |
|
|
|
|
getLinearFactor(objectId, vec); |
|
|
|
|
return vec; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private native void setAngularFactor(long objectId, float factor); |
|
|
|
|
private native void getLinearFactor(long objectId, Vector3f vec); |
|
|
|
|
|
|
|
|
|
public void setLinearFactor(Vector3f factor) { |
|
|
|
|
setLinearFactor(objectId, factor); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private native void setLinearFactor(long objectId, Vector3f factor); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* do not use manually, joints are added automatically |
|
|
|
@ -673,7 +701,13 @@ public class PhysicsRigidBody extends PhysicsCollisionObject { |
|
|
|
|
capsule.write(getGravity(), "gravity", Vector3f.ZERO); |
|
|
|
|
capsule.write(getFriction(), "friction", 0.5f); |
|
|
|
|
capsule.write(getRestitution(), "restitution", 0); |
|
|
|
|
capsule.write(getAngularFactor(), "angularFactor", 1); |
|
|
|
|
Vector3f angularFactor = getAngularFactor(null); |
|
|
|
|
if (angularFactor.x == angularFactor.y && angularFactor.y == angularFactor.z) { |
|
|
|
|
capsule.write(getAngularFactor(), "angularFactor", 1); |
|
|
|
|
} else { |
|
|
|
|
capsule.write(getAngularFactor(null), "angularFactor", Vector3f.UNIT_XYZ); |
|
|
|
|
capsule.write(getLinearFactor(), "linearFactor", Vector3f.UNIT_XYZ); |
|
|
|
|
} |
|
|
|
|
capsule.write(kinematic, "kinematic", false); |
|
|
|
|
|
|
|
|
|
capsule.write(getLinearDamping(), "linearDamping", 0); |
|
|
|
@ -703,7 +737,13 @@ public class PhysicsRigidBody extends PhysicsCollisionObject { |
|
|
|
|
setKinematic(capsule.readBoolean("kinematic", false)); |
|
|
|
|
|
|
|
|
|
setRestitution(capsule.readFloat("restitution", 0)); |
|
|
|
|
setAngularFactor(capsule.readFloat("angularFactor", 1)); |
|
|
|
|
Vector3f angularFactor = (Vector3f) capsule.readSavable("angularFactor", Vector3f.NAN.clone()); |
|
|
|
|
if(angularFactor == Vector3f.NAN) { |
|
|
|
|
setAngularFactor(capsule.readFloat("angularFactor", 1)); |
|
|
|
|
} else { |
|
|
|
|
setAngularFactor(angularFactor); |
|
|
|
|
setLinearFactor((Vector3f) capsule.readSavable("linearFactor", Vector3f.UNIT_XYZ.clone())); |
|
|
|
|
} |
|
|
|
|
setDamping(capsule.readFloat("linearDamping", 0), capsule.readFloat("angularDamping", 0)); |
|
|
|
|
setSleepingThresholds(capsule.readFloat("linearSleepingThreshold", 0.8f), capsule.readFloat("angularSleepingThreshold", 1.0f)); |
|
|
|
|
setCcdMotionThreshold(capsule.readFloat("ccdMotionThreshold", 0)); |
|
|
|
|