Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // If player location is found by scenegraph visitor
- if(spat instanceof Node && spat.getName().equals("Player") && null != physicsAppState && physicsAppState.isInitialized()) {
- // Ship model
- Spatial ship = assetManager.loadModel("Models/dark_fighter_6/dark_fighter_6.j3o");
- //ship.setLocalTranslation(spat.getWorldTranslation());
- //ship.setLocalRotation(spat.getWorldRotation());
- ship.setShadowMode(RenderQueue.ShadowMode.CastAndReceive);
- // Ship physics
- shipPhy = new SpaceShipControl(new GImpactCollisionShape(((Geometry)ship).getMesh()), 20000f);
- shipPhy.setMovementPower(2000f * 200f);
- shipPhy.setRotationPower(12000f);
- shipPhy.setRotationStabilityControl(0.6f);
- shipPhy.setSleepingThresholds(0.01f, 0.01f);
- spat.addControl(shipPhy);
- // Counter-rotation logic
- //ship.addControl(new ElectronicRotationStabilityControl());
- // Create gun
- gun = new Node("Gun");
- gun.setLocalTranslation(/*28.5f, -2.5f, 15.0f*/0.0f, -5.0f, 31.0f);
- // Add player's ship to the level
- ((Node)spat).attachChild(ship);
- ((Node)spat).attachChild(gun);
- physicsAppState.getPhysicsSpace().add(shipPhy);
- // Enable the delayed camera
- delayedCam = new DelayedCamera(cam, shipPhy, new Vector3f(0f, 7f, -80f));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement