- fix AbstractPhysicsControl applyTransform

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10340 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 12 years ago
parent 382169355c
commit ab6bdae774
  1. 5
      engine/src/bullet-common/com/jme3/bullet/control/AbstractPhysicsControl.java

@ -119,12 +119,12 @@ public abstract class AbstractPhysicsControl implements PhysicsControl {
} }
/** /**
* Applies a physics location to the spatial * Applies a physics transform to the spatial
* *
* @param worldLocation * @param worldLocation
* @param worldRotation * @param worldRotation
*/ */
protected void applyPhysicsLocation(Vector3f worldLocation, Quaternion worldRotation) { protected void applyPhysicsTransform(Vector3f worldLocation, Quaternion worldRotation) {
if (enabled && spatial != null) { if (enabled && spatial != null) {
Vector3f localLocation = spatial.getLocalTranslation(); Vector3f localLocation = spatial.getLocalTranslation();
Quaternion localRotationQuat = spatial.getLocalRotation(); Quaternion localRotationQuat = spatial.getLocalRotation();
@ -132,6 +132,7 @@ public abstract class AbstractPhysicsControl implements PhysicsControl {
localLocation.set(worldLocation).subtractLocal(spatial.getParent().getWorldTranslation()); localLocation.set(worldLocation).subtractLocal(spatial.getParent().getWorldTranslation());
localLocation.divideLocal(spatial.getParent().getWorldScale()); localLocation.divideLocal(spatial.getParent().getWorldScale());
tmp_inverseWorldRotation.set(spatial.getParent().getWorldRotation()).inverseLocal().multLocal(localLocation); tmp_inverseWorldRotation.set(spatial.getParent().getWorldRotation()).inverseLocal().multLocal(localLocation);
localRotationQuat.set(worldRotation);
tmp_inverseWorldRotation.set(spatial.getParent().getWorldRotation()).inverseLocal().mult(localRotationQuat, localRotationQuat); tmp_inverseWorldRotation.set(spatial.getParent().getWorldRotation()).inverseLocal().mult(localRotationQuat, localRotationQuat);
spatial.setLocalTranslation(localLocation); spatial.setLocalTranslation(localLocation);

Loading…
Cancel
Save