use of com.jme3.bullet.BulletAppState in project jmonkeyengine by jMonkeyEngine.
the class TestRagDoll method simpleInitApp.
@Override
public void simpleInitApp() {
bulletAppState = new BulletAppState();
stateManager.attach(bulletAppState);
bulletAppState.setDebugEnabled(true);
inputManager.addMapping("Pull ragdoll up", new MouseButtonTrigger(0));
inputManager.addListener(this, "Pull ragdoll up");
PhysicsTestHelper.createPhysicsTestWorld(rootNode, assetManager, bulletAppState.getPhysicsSpace());
createRagDoll();
}
use of com.jme3.bullet.BulletAppState in project jmonkeyengine by jMonkeyEngine.
the class TestRagdollCharacter method simpleInitApp.
public void simpleInitApp() {
setupKeys();
bulletAppState = new BulletAppState();
bulletAppState.setEnabled(true);
stateManager.attach(bulletAppState);
// bulletAppState.getPhysicsSpace().enableDebug(assetManager);
PhysicsTestHelper.createPhysicsTestWorld(rootNode, assetManager, bulletAppState.getPhysicsSpace());
initWall(2, 1, 1);
setupLight();
cam.setLocation(new Vector3f(-8, 0, -4));
cam.lookAt(new Vector3f(4, 0, -7), Vector3f.UNIT_Y);
model = (Node) assetManager.loadModel("Models/Sinbad/Sinbad.mesh.xml");
model.lookAt(new Vector3f(0, 0, -1), Vector3f.UNIT_Y);
model.setLocalTranslation(4, 0, -7f);
ragdoll = new KinematicRagdollControl(0.5f);
model.addControl(ragdoll);
getPhysicsSpace().add(ragdoll);
speed = 1.3f;
rootNode.attachChild(model);
AnimControl control = model.getControl(AnimControl.class);
animChannel = control.createChannel();
animChannel.setAnim("IdleTop");
control.addListener(this);
}
use of com.jme3.bullet.BulletAppState in project jmonkeyengine by jMonkeyEngine.
the class TestSweepTest method simpleInitApp.
@Override
public void simpleInitApp() {
obstacleCollisionShape = new CapsuleCollisionShape(0.3f, 0.5f);
capsuleCollisionShape = new CapsuleCollisionShape(1f, 1f);
stateManager.attach(bulletAppState);
capsule = new Node("capsule");
capsule.move(-2, 0, 0);
capsule.addControl(new RigidBodyControl(capsuleCollisionShape, 1));
capsule.getControl(RigidBodyControl.class).setKinematic(true);
bulletAppState.getPhysicsSpace().add(capsule);
rootNode.attachChild(capsule);
obstacle = new Node("obstacle");
obstacle.move(2, 0, 0);
RigidBodyControl bodyControl = new RigidBodyControl(obstacleCollisionShape, 0);
obstacle.addControl(bodyControl);
bulletAppState.getPhysicsSpace().add(obstacle);
rootNode.attachChild(obstacle);
bulletAppState.setDebugEnabled(true);
}
use of com.jme3.bullet.BulletAppState in project jmonkeyengine by jMonkeyEngine.
the class TestPhysicsRayCast method simpleInitApp.
@Override
public void simpleInitApp() {
stateManager.attach(bulletAppState);
initCrossHair();
Spatial s = assetManager.loadModel("Models/Elephant/Elephant.mesh.xml");
s.setLocalScale(0.1f);
CollisionShape collisionShape = CollisionShapeFactory.createMeshShape(s);
Node n = new Node("elephant");
n.addControl(new RigidBodyControl(collisionShape, 1));
n.getControl(RigidBodyControl.class).setKinematic(true);
bulletAppState.getPhysicsSpace().add(n);
rootNode.attachChild(n);
bulletAppState.setDebugEnabled(true);
}
use of com.jme3.bullet.BulletAppState in project jmonkeyengine by jMonkeyEngine.
the class TestQ3 method simpleInitApp.
public void simpleInitApp() {
bulletAppState = new BulletAppState();
stateManager.attach(bulletAppState);
flyCam.setMoveSpeed(100);
setupKeys();
this.cam.setFrustumFar(2000);
DirectionalLight dl = new DirectionalLight();
dl.setColor(ColorRGBA.White.clone().multLocal(2));
dl.setDirection(new Vector3f(-1, -1, -1).normalize());
rootNode.addLight(dl);
AmbientLight am = new AmbientLight();
am.setColor(ColorRGBA.White.mult(2));
rootNode.addLight(am);
// load the level from zip or http zip
if (useHttp) {
assetManager.registerLocator("http://jmonkeyengine.googlecode.com/files/quake3level.zip", HttpZipLocator.class);
} else {
assetManager.registerLocator("quake3level.zip", ZipLocator.class);
}
// create the geometry and attach it
MaterialList matList = (MaterialList) assetManager.loadAsset("Scene.material");
OgreMeshKey key = new OgreMeshKey("main.meshxml", matList);
gameLevel = (Node) assetManager.loadAsset(key);
gameLevel.setLocalScale(0.1f);
// add a physics control, it will generate a MeshCollisionShape based on the gameLevel
gameLevel.addControl(new RigidBodyControl(0));
player = new PhysicsCharacter(new SphereCollisionShape(5), .01f);
player.setJumpSpeed(20);
player.setFallSpeed(30);
player.setGravity(30);
player.setPhysicsLocation(new Vector3f(60, 10, -60));
rootNode.attachChild(gameLevel);
getPhysicsSpace().addAll(gameLevel);
getPhysicsSpace().add(player);
}
Aggregations