- enable animation for ragdoll test
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7227 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
7f7fc50ab5
commit
75d0c560bf
@ -396,6 +396,7 @@ public class RagdollControl implements PhysicsControl, PhysicsCollisionListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setEnabled(boolean enabled) {
|
public void setEnabled(boolean enabled) {
|
||||||
|
if(this.enabled == enabled) return;
|
||||||
this.enabled = enabled;
|
this.enabled = enabled;
|
||||||
if (!enabled && space != null) {
|
if (!enabled && space != null) {
|
||||||
removeFromPhysicsSpace();
|
removeFromPhysicsSpace();
|
||||||
|
@ -72,7 +72,7 @@ public class PhysicsTestHelper {
|
|||||||
Sphere sphere = new Sphere(8, 8, 1);
|
Sphere sphere = new Sphere(8, 8, 1);
|
||||||
Geometry sphereGeometry = new Geometry("Sphere", sphere);
|
Geometry sphereGeometry = new Geometry("Sphere", sphere);
|
||||||
sphereGeometry.setMaterial(material);
|
sphereGeometry.setMaterial(material);
|
||||||
sphereGeometry.setLocalTranslation(2, -4, 2);
|
sphereGeometry.setLocalTranslation(4, -4, 2);
|
||||||
sphereGeometry.addControl(new RigidBodyControl(new MeshCollisionShape(sphere), 0));
|
sphereGeometry.addControl(new RigidBodyControl(new MeshCollisionShape(sphere), 0));
|
||||||
rootNode.attachChild(sphereGeometry);
|
rootNode.attachChild(sphereGeometry);
|
||||||
space.add(sphereGeometry);
|
space.add(sphereGeometry);
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
*/
|
*/
|
||||||
package jme3test.bullet;
|
package jme3test.bullet;
|
||||||
|
|
||||||
|
import com.jme3.animation.AnimChannel;
|
||||||
import com.jme3.animation.AnimControl;
|
import com.jme3.animation.AnimControl;
|
||||||
import com.jme3.animation.Bone;
|
import com.jme3.animation.Bone;
|
||||||
import com.jme3.bullet.BulletAppState;
|
import com.jme3.bullet.BulletAppState;
|
||||||
@ -156,6 +157,8 @@ public class TestBoneRagdoll extends SimpleApplication implements RagdollCollisi
|
|||||||
// chaseCamera.setLookAtOffset(Vector3f.UNIT_Y.mult(4));
|
// chaseCamera.setLookAtOffset(Vector3f.UNIT_Y.mult(4));
|
||||||
// model.addControl(chaseCamera);
|
// model.addControl(chaseCamera);
|
||||||
|
|
||||||
|
final AnimChannel channel = control.createChannel();
|
||||||
|
channel.setAnim("Walk");
|
||||||
|
|
||||||
inputManager.addListener(new ActionListener() {
|
inputManager.addListener(new ActionListener() {
|
||||||
|
|
||||||
@ -173,8 +176,8 @@ public class TestBoneRagdoll extends SimpleApplication implements RagdollCollisi
|
|||||||
bulletg.setLocalTranslation(cam.getLocation());
|
bulletg.setLocalTranslation(cam.getLocation());
|
||||||
bulletg.setLocalScale(timer);
|
bulletg.setLocalScale(timer);
|
||||||
bulletCollisionShape = new SphereCollisionShape(timer);
|
bulletCollisionShape = new SphereCollisionShape(timer);
|
||||||
// RigidBodyControl bulletNode = new BombControl(assetManager, bulletCollisionShape, 1);
|
RigidBodyControl bulletNode = new BombControl(assetManager, bulletCollisionShape, 1);
|
||||||
RigidBodyControl bulletNode = new RigidBodyControl(bulletCollisionShape, timer * 10);
|
// RigidBodyControl bulletNode = new RigidBodyControl(bulletCollisionShape, timer * 10);
|
||||||
bulletNode.setCcdMotionThreshold(0.001f);
|
bulletNode.setCcdMotionThreshold(0.001f);
|
||||||
bulletNode.setLinearVelocity(cam.getDirection().mult(80));
|
bulletNode.setLinearVelocity(cam.getDirection().mult(80));
|
||||||
bulletg.addControl(bulletNode);
|
bulletg.addControl(bulletNode);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user