Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.jme3.app.SimpleApplication;
- import com.jme3.bullet.BulletAppState;
- import com.jme3.bullet.control.RigidBodyControl;
- import com.jme3.bullet.util.CollisionShapeFactory;
- import com.jme3.material.Material;
- import com.jme3.math.ColorRGBA;
- import com.jme3.math.Vector3f;
- import com.jme3.scene.Geometry;
- import com.jme3.scene.shape.Box;
- import com.jme3.system.AppSettings;
- public class CodeExample extends SimpleApplication{
- public static void main(String[] args) {
- CodeExample ex = new CodeExample();
- AppSettings set = new AppSettings(true);
- set.setFrameRate(100);
- ex.setSettings(set);
- ex.setShowSettings(false);
- ex.start();
- }
- public void simpleInitApp() {
- BulletAppState bas = new BulletAppState();
- stateManager.attach(bas);
- Geometry geom = new Geometry("body", new Box(1,1,1));
- geom.setMaterial(new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"));
- geom.getMaterial().setColor("Color", ColorRGBA.Orange);
- RigidBodyControl rbc = new RigidBodyControl(CollisionShapeFactory.createBoxShape(geom), 10);
- geom.addControl(rbc);
- bas.getPhysicsSpace().add(rbc);
- rootNode.attachChild(geom);
- cam.setLocation(new Vector3f(0, -20, 50));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement