= Remote-Controlling the Camera
:author: 
:revnumber: 
:revdate: 2016/03/17 20:48
:keywords: camera, documentation, cinematics
:relfileprefix: ../../
:imagesdir: ../..
ifdef::env-github,env-browser[:outfilesuffix: .adoc]



== Positioning the Camera

You can steer the camera using <<jme3/advanced/cinematics#,Cinematics>>:

.  Create a Cinematic.
.  Create a CameraNode and bind the camera object to the Cinematic. Note that we also give the camera node a name in this step. 
+
[source,java]
----
CameraNode camNode = cinematic.bindCamera("topView", cam);
----

.  Position the camera node in its start location.
.  Use activateCamera() to give the control of the camera to this node. You now see the scene from this camera's point of view. For example to see through the camera node named “topView, 6 seconds after the start of the cinematic, you'd write 
+
[source,java]
----
cinematic.activateCamera(6, "topView");
----



=== Code Sample

[source,java]
----

flyCam.setEnabled(false);
Cinematic cinematic = new Cinematic(rootNode, 20);

CameraNode camNodeTop = cinematic.bindCamera("topView", cam);
camNodeTop.setControlDir(ControlDirection.SpatialToCamera);
camNodeTop.getControl(0).setEnabled(false);

CameraNode camNodeSide = cinematic.bindCamera("sideView", cam);
camNodeSide.setControlDir(ControlDirection.CameraToSpatial);
camNodeSide.getControl(0).setEnabled(false);

----


== Moving the Camera

If desired, attach the camNode to a MotionEvent to let it travel along waypoints. This is demonstrated in the link:https://github.com/jMonkeyEngine/jmonkeyengine/blob/master/jme3-examples/src/main/java/jme3test/animation/TestCameraMotionPath.java[TestCameraMotionPath.java] example.
