This commit is contained in:
parent
979ff20c27
commit
988bcc1c7d
1 changed files with 30 additions and 0 deletions
30
src/sg/test/PhysicsTest.java
Normal file
30
src/sg/test/PhysicsTest.java
Normal file
|
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue