Added Third person cam and input

This commit is contained in:
Ziver Koc 2009-03-24 16:21:29 +00:00
parent e70945a5d9
commit 97f718b585
6 changed files with 194 additions and 52 deletions

View file

@ -8,6 +8,7 @@ import sg.util.SGUtil;
import com.jme.input.InputHandler;
import com.jme.light.PointLight;
import com.jme.math.FastMath;
import com.jme.math.Vector3f;
import com.jme.renderer.ColorRGBA;
import com.jme.renderer.Renderer;
@ -49,16 +50,19 @@ public class InGameState extends CameraGameState {
rootNode.attachChild(staticNode);
// environment
environment = new Environment(rootNode);
environment = new Environment(rootNode, physicsSpace);
rootNode.attachChild(environment);
// ship
Node ship = SGUtil.loadModel("sg/data/models/ships/G6.3ds");
DynamicPhysicsNode ship = physicsSpace.createDynamicNode();
Node shipModel = SGUtil.loadModel("sg/data/models/ships/G6.3ds");
shipModel.getLocalRotation().fromAngleAxis(-90*FastMath.DEG_TO_RAD, Vector3f.UNIT_Y);
ship.attachChild(shipModel);
ship.setLocalTranslation(new Vector3f( 0, 0, 40));
rootNode.attachChild(ship);
// inputs
input = new SGThirdPersonHandler( cam, ship );
input = new SGThirdPersonHandler( ship, ship ,cam );
// lights
/** Set up a basic, default light. */