Advertisement
Guest User

Untitled

a guest
May 7th, 2014
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.47 KB | None | 0 0
  1.         // If player location is found by scenegraph visitor
  2.         if(spat instanceof Node && spat.getName().equals("Player") && null != physicsAppState && physicsAppState.isInitialized()) {
  3.             // Ship model
  4.             Spatial ship = assetManager.loadModel("Models/dark_fighter_6/dark_fighter_6.j3o");
  5.             //ship.setLocalTranslation(spat.getWorldTranslation());
  6.             //ship.setLocalRotation(spat.getWorldRotation());
  7.             ship.setShadowMode(RenderQueue.ShadowMode.CastAndReceive);
  8.             // Ship physics
  9.             shipPhy = new SpaceShipControl(new GImpactCollisionShape(((Geometry)ship).getMesh()), 20000f);
  10.             shipPhy.setMovementPower(2000f * 200f);
  11.             shipPhy.setRotationPower(12000f);
  12.             shipPhy.setRotationStabilityControl(0.6f);
  13.             shipPhy.setSleepingThresholds(0.01f, 0.01f);
  14.             spat.addControl(shipPhy);
  15.             // Counter-rotation logic
  16.             //ship.addControl(new ElectronicRotationStabilityControl());
  17.             // Create gun
  18.             gun = new Node("Gun");
  19.             gun.setLocalTranslation(/*28.5f, -2.5f, 15.0f*/0.0f, -5.0f, 31.0f);
  20.             // Add player's ship to the level
  21.             ((Node)spat).attachChild(ship);
  22.             ((Node)spat).attachChild(gun);
  23.             physicsAppState.getPhysicsSpace().add(shipPhy);
  24.             // Enable the delayed camera
  25.             delayedCam = new DelayedCamera(cam, shipPhy, new Vector3f(0f, 7f, -80f));
  26.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement