From 988bcc1c7d268a9464bd910557dcf7462db5690d Mon Sep 17 00:00:00 2001 From: Daniel Collin Date: Tue, 10 Mar 2009 12:29:28 +0000 Subject: [PATCH] --- src/sg/test/PhysicsTest.java | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/sg/test/PhysicsTest.java diff --git a/src/sg/test/PhysicsTest.java b/src/sg/test/PhysicsTest.java new file mode 100644 index 0000000..0209fce --- /dev/null +++ b/src/sg/test/PhysicsTest.java @@ -0,0 +1,30 @@ +package sg.test; + +import java.util.logging.Level; +import java.util.logging.Logger; + +import com.jmex.physics.DynamicPhysicsNode; +import com.jmex.physics.StaticPhysicsNode; +import com.jmex.physics.geometry.PhysicsBox; +import com.jmex.physics.util.SimplePhysicsGame; + +public class PhysicsTest extends SimplePhysicsGame { + + protected void simpleInitGame() { + StaticPhysicsNode staticNode = getPhysicsSpace().createStaticNode(); + rootNode.attachChild( staticNode ); + PhysicsBox floorBox = staticNode.createBox( "floor" ); + floorBox.getLocalScale().set( 10, 0.5f, 10 ); + DynamicPhysicsNode dynamicNode = getPhysicsSpace().createDynamicNode(); + rootNode.attachChild( dynamicNode ); + dynamicNode.createBox( "falling box" ); + dynamicNode.getLocalTranslation().set( 0, 5, 0 ); + showPhysics = true; + } + + public static void main( String[] args ) { + Logger.getLogger( "" ).setLevel( Level.WARNING ); + PhysicsTest game = new PhysicsTest(); + game.start(); + } +} \ No newline at end of file