Game Development Reference
In-Depth Information
camNode.setControlDir(CameraControl.ControlDirection.SpatialToCamera);
head.attachChild(camNode);
}
Note
Cameras are logical objects and are not part of the scene graph. The Camer-
aNode keeps an instance of Camera. It is a Node and propagates its own loca-
tion to the Camera. It can also do the opposite and apply the Camera's location to
CameraNode (and thus, any other spatial object attached to it).
13. To use GameCharacterControl in an application, add the following lines of
code in the simpleInit method of an application. Instantiate a new (invisible)
Node instance that you can add to the GameCharacterControl class. Set
the application's camera to be used as a character, and add it to physicsSpace
as follows:
Node playerNode = new Node("Player");
GameCharacterControl charControl = new
GameCharacterControl(0.5f, 2.5f, 8f);
charControl.setCamera(cam);
playerNode.addControl(charControl);
charControl.setGravity(normalGravity);
bulletAppState.getPhysicsSpace().add(charControl);
Search WWH ::




Custom Search