Browse Source

SDK : Scene composer MoveManager now accounts for parent node scale when moving a spatial in the scene composer. This is to avoid the spatial to "jump" when starting moving.

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10732 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
rem..om 12 năm trước cách đây
mục cha
commit
20123c74ea

+ 2 - 1
sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/tools/MoveManager.java

@@ -122,9 +122,10 @@ public class MoveManager {
         //computing the inverse world transform to get the new localtranslation        
         newPos.subtractLocal(spatial.getParent().getWorldTranslation());
         newPos = spatial.getParent().getWorldRotation().inverse().normalizeLocal().multLocal(newPos);
+        newPos.divideLocal(spatial.getParent().getWorldScale());
        
         lastLoc = newPos;
-        spatial.setLocalTranslation(newPos);
+        spatial.setLocalTranslation(newPos);        
 
         RigidBodyControl control = spatial.getControl(RigidBodyControl.class);
         if (control != null) {