Keyframing Camera rotation within a cinematic

Hi Everyone!

I would like a nice intro cinematic at the start of my game. It involves camera movement. More specifically, I have created a motion path for the camera to follow (which it does, successfully!), but I want to add in some custom rotation to the camera.

I am aware that you can tell the camera to look at a specific object/location, but is there a way that I can keyframe specific rotation values for the camera (to yield smooth motion)?

My cinematic method, should it be of any use

public void introCinematic()
Cinematic iCinematic = new Cinematic(rootNode, 25);
MotionEvent cinematicMotionControl;
CameraNode cinematicCamNode = new CameraNode(“IntroCinematic”, cam);

    MotionPath introMotionPath_1 = new MotionPath();
    introMotionPath_1.addWayPoint(new Vector3f(75,130,510));
    introMotionPath_1.addWayPoint(new Vector3f(75,110,450));
    introMotionPath_1.addWayPoint(new Vector3f(75,35,250));
    introMotionPath_1.addWayPoint(new Vector3f(0,10,0));
    introMotionPath_1.addWayPoint(new Vector3f(0,25,-150));
    introMotionPath_1.addWayPoint(new Vector3f(0,50,-300));
    introMotionPath_1.enableDebugShape(assetManager, rootNode);
    cinematicMotionControl = new MotionEvent(cinematicCamNode, introMotionPath_1);
    //cinematicMotionControl.setLookAt(new Vector3f(0,50,0),new Vector3f(0,1,0));
    iCinematic.addListener(new CinematicEventListener(){

        public void onPlay(CinematicEvent cinematic) {

        public void onPause(CinematicEvent cinematic) {

        public void onStop(CinematicEvent cinematic) {
            System.out.println("Reached End!");


Thanks in advance!

Sorry I missed this post.
What you can do is to have the camera look at a dummy node. Then you can have another motion path for this dummy node so you can control the camera position and lookAt target.

Hi Nehon,

Thanks for your reply - this is what I tried originally, and it certainly does work. I was looking for an alternative, whereby I could keyframe the camera itself.

In the end, I managed to get this working by adding the following code, in addition to my motion path:

AnimationFactory factory = new AnimationFactory(30, “camAnim”);
factory.addKeyFrameRotationAngles(0, 0, 3f, 0);
factory.addKeyFrameRotationAngles(200, 0.5f, 3f, 0);
factory.addKeyFrameRotationAngles(500, -0.2f, 0, 0);
factory.addKeyFrameRotationAngles(750, -0.2f, 0, 0);
final AnimControl control = new AnimControl();

    iCinematic.addCinematicEvent(0, new AnimationEvent(cinematicCamNode, "camAnim", LoopMode.DontLoop));;


In the past, when I tried to do something similar, it caused the game to either crash (freeze) completely, or render a grey screen. I think this had something to do with one of the methods I used, not entirely sure. But the above code works. Thanks for your help!

1 Like

Yep, that’s another valid way to do it. Well done.