From 53da7c4de4a77b68dd012dbc7eecbaee2e161f4e Mon Sep 17 00:00:00 2001 From: "sha..rd" Date: Sun, 10 Apr 2011 21:03:55 +0000 Subject: [PATCH] * Added CCD threshold to BoneRagdoll test so that balls collide more often * Reduced BoneRagdoll constraints to PI/8 * Added an ambient light so the ragdoll is more visible * Fixed bug with Unshaded.j3md failing with glow map git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7224 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../src/core-data/Common/MatDefs/Misc/Unshaded.j3md | 1 + engine/src/test/jme3test/bullet/TestBoneRagdoll.java | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/engine/src/core-data/Common/MatDefs/Misc/Unshaded.j3md b/engine/src/core-data/Common/MatDefs/Misc/Unshaded.j3md index c05f1aa2d..4a49426c5 100644 --- a/engine/src/core-data/Common/MatDefs/Misc/Unshaded.j3md +++ b/engine/src/core-data/Common/MatDefs/Misc/Unshaded.j3md @@ -60,6 +60,7 @@ MaterialDef Unshaded { Defines { HAS_GLOWMAP : GlowMap HAS_GLOWCOLOR : GlowColor + HAS_COLORMAP // Must be passed so that Unshaded.vert exports texCoord. } } diff --git a/engine/src/test/jme3test/bullet/TestBoneRagdoll.java b/engine/src/test/jme3test/bullet/TestBoneRagdoll.java index 23cdd0f74..0fc99a34e 100644 --- a/engine/src/test/jme3test/bullet/TestBoneRagdoll.java +++ b/engine/src/test/jme3test/bullet/TestBoneRagdoll.java @@ -48,6 +48,7 @@ import com.jme3.input.MouseInput; import com.jme3.input.controls.ActionListener; import com.jme3.input.controls.KeyTrigger; import com.jme3.input.controls.MouseButtonTrigger; +import com.jme3.light.AmbientLight; import com.jme3.light.DirectionalLight; import com.jme3.material.Material; import com.jme3.math.ColorRGBA; @@ -117,7 +118,9 @@ public class TestBoneRagdoll extends SimpleApplication implements RagdollCollisi ragdoll.addCollisionListener(this); model.addControl(ragdoll); - ragdoll.setJointLimit("head", FastMath.QUARTER_PI, -FastMath.QUARTER_PI, FastMath.QUARTER_PI, -FastMath.QUARTER_PI, FastMath.QUARTER_PI, -FastMath.QUARTER_PI); + float eighth_pi = FastMath.PI * 0.125f; + + ragdoll.setJointLimit("head", eighth_pi, -eighth_pi, eighth_pi, -eighth_pi, eighth_pi, -eighth_pi); ragdoll.setJointLimit("spinehigh", FastMath.QUARTER_PI, -FastMath.QUARTER_PI, 0, 0, FastMath.QUARTER_PI, -FastMath.QUARTER_PI); @@ -133,7 +136,6 @@ public class TestBoneRagdoll extends SimpleApplication implements RagdollCollisi ragdoll.setJointLimit("uparm.right", FastMath.HALF_PI, -FastMath.QUARTER_PI, 0, 0, FastMath.QUARTER_PI, -FastMath.HALF_PI); ragdoll.setJointLimit("uparm.left", FastMath.HALF_PI, -FastMath.QUARTER_PI, 0, 0, FastMath.QUARTER_PI, -FastMath.HALF_PI); - ragdoll.setJointLimit("arm.right", FastMath.PI, 0, 0, 0, 0, 0); ragdoll.setJointLimit("arm.left", FastMath.PI, 0, 0, 0, 0, 0); @@ -173,6 +175,7 @@ public class TestBoneRagdoll extends SimpleApplication implements RagdollCollisi bulletCollisionShape = new SphereCollisionShape(timer); // 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); rootNode.attachChild(bulletg); @@ -188,6 +191,10 @@ public class TestBoneRagdoll extends SimpleApplication implements RagdollCollisi } private void setupLight() { + AmbientLight al = new AmbientLight(); + al.setColor(ColorRGBA.White.mult(10)); + rootNode.addLight(al); + DirectionalLight dl = new DirectionalLight(); dl.setDirection(new Vector3f(-0.1f, -0.7f, -1).normalizeLocal()); dl.setColor(new ColorRGBA(1f, 1f, 1f, 1.0f));