- Make MoveTool move physics objects correctly

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8603 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 13 years ago
parent 95d2b2d710
commit 5826b4cefe
  1. 10
      sdk/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;

Loading…
Cancel
Save