Cinematics / MotionPath Weirdness

Hey all,

I’m having an issue with cinematics. Events are running far more quickly than specified. In the testcase I have created below, the camera should move along the track in 30 seconds. However, it runs on my computer in just under 8 seconds. Am I doing something wrong?



[java]package mygame;



import com.jme3.app.SimpleApplication;

import com.jme3.cinematic.Cinematic;

import com.jme3.cinematic.MotionPath;

import com.jme3.cinematic.events.CinematicEvent;

import com.jme3.cinematic.events.CinematicEventListener;

import com.jme3.cinematic.events.MotionTrack;

import com.jme3.math.Vector3f;

import com.jme3.renderer.RenderManager;

import com.jme3.scene.CameraNode;

import com.jme3.scene.control.CameraControl.ControlDirection;



/**

  • The camera should reach the box in 30 seconds

    */

    public class Main extends SimpleApplication {



    private float desiredTime = 30; // seconds

    private Cinematic cinematic;



    public static void main(String[] args) {

    Main app = new Main();

    app.start();

    }



    @Override

    public void simpleInitApp() {



    Vector3f start = new Vector3f(-25,0,0);

    Vector3f finish = new Vector3f(25,0,0);



    // Position camera at start

    cam.setLocation(start);

    cam.lookAt(finish, Vector3f.UNIT_Y.clone());



    // Create path between the points

    MotionPath path = new MotionPath();

    path.addWayPoint(start);

    path.addWayPoint(finish);

    path.enableDebugShape(assetManager, rootNode);



    // Create cinematic and bind to camera

    cinematic = new Cinematic(rootNode, desiredTime);

    stateManager.attach(cinematic);

    CameraNode camNode = cinematic.bindCamera(“cam”, cam);

    camNode.setControlDir(ControlDirection.SpatialToCamera);

    cinematic.activateCamera(0, “cam”);



    // Create motion track

    MotionTrack track = new MotionTrack(camNode, path);

    track.setDirectionType(MotionTrack.Direction.Path);

    track.setSpeed(1f);

    track.setInitialDuration(desiredTime);

    cinematic.addCinematicEvent(0, track);



    // Add listeners

    cinematic.addListener(new CinematicEventListener() {

    public void onPlay(CinematicEvent cinematic) {

    System.out.println(“Playing”);

    }

    public void onPause(CinematicEvent cinematic) {}

    public void onStop(CinematicEvent cinematic) {

    flyCam.setEnabled(true);

    }

    });



    // Begin

    cinematic.play();

    }



    @Override

    public void simpleUpdate(float tpf) {}



    @Override

    public void simpleRender(RenderManager rm) {}

    }

    [/java]



    (I am using JmonkeyEngine 3 beta downloaded 24 November 2011 - if there’s a known bug causing this I’ll update!)



    Many thanks,

    Peter.

Just to confirm this still is a problem in a more recent release. Any ideas, @nehon ?

You have to do the updates with the SDK (Help->Check for updates), downloading a new SDK won’t update anything, its still vanilla beta3.0.

That fixed it! Sorry, feeling stupid now. Project nearing completion, looking forward to announcing it soon :slight_smile:

1 Like