Selaa lähdekoodia

SDK:
- Make MoveTool move physics objects correctly

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8603 75d07b2b-3a1a-0410-a2c5-0572b91ccdca

nor..67 14 vuotta sitten
vanhempi
commit
31bd2bd694

+ 10 - 0
jme3-scenecomposer/src/com/jme3/gde/scenecomposer/tools/MoveTool.java

@@ -5,6 +5,8 @@
 package com.jme3.gde.scenecomposer.tools;
 
 import com.jme3.asset.AssetManager;
+import com.jme3.bullet.control.CharacterControl;
+import com.jme3.bullet.control.RigidBodyControl;
 import com.jme3.gde.core.sceneexplorer.nodes.JmeNode;
 import com.jme3.gde.core.undoredo.AbstractUndoableSceneEdit;
 import com.jme3.gde.scenecomposer.SceneComposerToolController;
@@ -135,6 +137,14 @@ public class MoveTool extends SceneEditTool {
         Vector3f newPos = planeHit.subtract(offset);
         lastLoc = newPos;
         toolController.getSelectedSpatial().setLocalTranslation(newPos);
+        RigidBodyControl control = toolController.getSelectedSpatial().getControl(RigidBodyControl.class);
+        if (control != null) {
+            control.setPhysicsLocation(toolController.getSelectedSpatial().getWorldTranslation());
+        }
+        CharacterControl character = toolController.getSelectedSpatial().getControl(CharacterControl.class);
+        if (character != null) {
+            character.setPhysicsLocation(toolController.getSelectedSpatial().getWorldTranslation());
+        }
         updateToolsTransformation();
         
         wasDragging = true;