OSDN Git Service

* Added CCD threshold to BoneRagdoll test so that balls collide more often
authorshadowislord <shadowislord@75d07b2b-3a1a-0410-a2c5-0572b91ccdca>
Sun, 10 Apr 2011 21:03:55 +0000 (21:03 +0000)
committershadowislord <shadowislord@75d07b2b-3a1a-0410-a2c5-0572b91ccdca>
Sun, 10 Apr 2011 21:03:55 +0000 (21:03 +0000)
 * 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: http://jmonkeyengine.googlecode.com/svn/trunk@7224 75d07b2b-3a1a-0410-a2c5-0572b91ccdca

engine/src/core-data/Common/MatDefs/Misc/Unshaded.j3md
engine/src/test/jme3test/bullet/TestBoneRagdoll.java

index c05f1aa..4a49426 100644 (file)
@@ -60,6 +60,7 @@ MaterialDef Unshaded {
         Defines {\r
             HAS_GLOWMAP : GlowMap\r
             HAS_GLOWCOLOR : GlowColor\r
+            HAS_COLORMAP // Must be passed so that Unshaded.vert exports texCoord.\r
         }\r
     }\r
 \r
index 23cdd0f..0fc99a3 100644 (file)
@@ -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));