* 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
3.0
sha..rd 14 years ago
parent 6417263674
commit 53da7c4de4
  1. 1
      engine/src/core-data/Common/MatDefs/Misc/Unshaded.j3md
  2. 11
      engine/src/test/jme3test/bullet/TestBoneRagdoll.java

@ -60,6 +60,7 @@ MaterialDef Unshaded {
Defines { Defines {
HAS_GLOWMAP : GlowMap HAS_GLOWMAP : GlowMap
HAS_GLOWCOLOR : GlowColor HAS_GLOWCOLOR : GlowColor
HAS_COLORMAP // Must be passed so that Unshaded.vert exports texCoord.
} }
} }

@ -48,6 +48,7 @@ import com.jme3.input.MouseInput;
import com.jme3.input.controls.ActionListener; import com.jme3.input.controls.ActionListener;
import com.jme3.input.controls.KeyTrigger; import com.jme3.input.controls.KeyTrigger;
import com.jme3.input.controls.MouseButtonTrigger; import com.jme3.input.controls.MouseButtonTrigger;
import com.jme3.light.AmbientLight;
import com.jme3.light.DirectionalLight; import com.jme3.light.DirectionalLight;
import com.jme3.material.Material; import com.jme3.material.Material;
import com.jme3.math.ColorRGBA; import com.jme3.math.ColorRGBA;
@ -117,7 +118,9 @@ public class TestBoneRagdoll extends SimpleApplication implements RagdollCollisi
ragdoll.addCollisionListener(this); ragdoll.addCollisionListener(this);
model.addControl(ragdoll); 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); 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.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("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.right", FastMath.PI, 0, 0, 0, 0, 0);
ragdoll.setJointLimit("arm.left", 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); 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.setLinearVelocity(cam.getDirection().mult(80)); bulletNode.setLinearVelocity(cam.getDirection().mult(80));
bulletg.addControl(bulletNode); bulletg.addControl(bulletNode);
rootNode.attachChild(bulletg); rootNode.attachChild(bulletg);
@ -188,6 +191,10 @@ public class TestBoneRagdoll extends SimpleApplication implements RagdollCollisi
} }
private void setupLight() { private void setupLight() {
AmbientLight al = new AmbientLight();
al.setColor(ColorRGBA.White.mult(10));
rootNode.addLight(al);
DirectionalLight dl = new DirectionalLight(); DirectionalLight dl = new DirectionalLight();
dl.setDirection(new Vector3f(-0.1f, -0.7f, -1).normalizeLocal()); dl.setDirection(new Vector3f(-0.1f, -0.7f, -1).normalizeLocal());
dl.setColor(new ColorRGBA(1f, 1f, 1f, 1.0f)); dl.setColor(new ColorRGBA(1f, 1f, 1f, 1.0f));

Loading…
Cancel
Save