From 75d0c560bf8dd72dc1757253b230250a1665578d Mon Sep 17 00:00:00 2001 From: "nor..67" Date: Mon, 11 Apr 2011 12:24:08 +0000 Subject: [PATCH] - enable animation for ragdoll test git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7227 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../jbullet/com/jme3/bullet/control/RagdollControl.java | 1 + engine/src/test/jme3test/bullet/PhysicsTestHelper.java | 2 +- engine/src/test/jme3test/bullet/TestBoneRagdoll.java | 7 +++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/engine/src/jbullet/com/jme3/bullet/control/RagdollControl.java b/engine/src/jbullet/com/jme3/bullet/control/RagdollControl.java index 3985b019b..629bfb488 100644 --- a/engine/src/jbullet/com/jme3/bullet/control/RagdollControl.java +++ b/engine/src/jbullet/com/jme3/bullet/control/RagdollControl.java @@ -396,6 +396,7 @@ public class RagdollControl implements PhysicsControl, PhysicsCollisionListener } public void setEnabled(boolean enabled) { + if(this.enabled == enabled) return; this.enabled = enabled; if (!enabled && space != null) { removeFromPhysicsSpace(); diff --git a/engine/src/test/jme3test/bullet/PhysicsTestHelper.java b/engine/src/test/jme3test/bullet/PhysicsTestHelper.java index 447544db8..04f7720c9 100644 --- a/engine/src/test/jme3test/bullet/PhysicsTestHelper.java +++ b/engine/src/test/jme3test/bullet/PhysicsTestHelper.java @@ -72,7 +72,7 @@ public class PhysicsTestHelper { Sphere sphere = new Sphere(8, 8, 1); Geometry sphereGeometry = new Geometry("Sphere", sphere); sphereGeometry.setMaterial(material); - sphereGeometry.setLocalTranslation(2, -4, 2); + sphereGeometry.setLocalTranslation(4, -4, 2); sphereGeometry.addControl(new RigidBodyControl(new MeshCollisionShape(sphere), 0)); rootNode.attachChild(sphereGeometry); space.add(sphereGeometry); diff --git a/engine/src/test/jme3test/bullet/TestBoneRagdoll.java b/engine/src/test/jme3test/bullet/TestBoneRagdoll.java index 0fc99a34e..e759cf830 100644 --- a/engine/src/test/jme3test/bullet/TestBoneRagdoll.java +++ b/engine/src/test/jme3test/bullet/TestBoneRagdoll.java @@ -31,6 +31,7 @@ */ package jme3test.bullet; +import com.jme3.animation.AnimChannel; import com.jme3.animation.AnimControl; import com.jme3.animation.Bone; import com.jme3.bullet.BulletAppState; @@ -156,6 +157,8 @@ public class TestBoneRagdoll extends SimpleApplication implements RagdollCollisi // chaseCamera.setLookAtOffset(Vector3f.UNIT_Y.mult(4)); // model.addControl(chaseCamera); + final AnimChannel channel = control.createChannel(); + channel.setAnim("Walk"); inputManager.addListener(new ActionListener() { @@ -173,8 +176,8 @@ public class TestBoneRagdoll extends SimpleApplication implements RagdollCollisi bulletg.setLocalTranslation(cam.getLocation()); bulletg.setLocalScale(timer); bulletCollisionShape = new SphereCollisionShape(timer); - // RigidBodyControl bulletNode = new BombControl(assetManager, bulletCollisionShape, 1); - RigidBodyControl bulletNode = new RigidBodyControl(bulletCollisionShape, timer * 10); + RigidBodyControl bulletNode = new BombControl(assetManager, bulletCollisionShape, 1); +// RigidBodyControl bulletNode = new RigidBodyControl(bulletCollisionShape, timer * 10); bulletNode.setCcdMotionThreshold(0.001f); bulletNode.setLinearVelocity(cam.getDirection().mult(80)); bulletg.addControl(bulletNode);