[Solved] Problem with MotionTrack::pause()


I’m trying to pause a spatial when it reaches a way point of a MotionPath, but the spatial vanishes after the second point.

Here’s the code:


package mygame;

import com.jme3.animation.LoopMode;

import com.jme3.app.SimpleApplication;

import com.jme3.cinematic.MotionPath;

import com.jme3.cinematic.MotionPathListener;

import com.jme3.cinematic.PlayState;

import com.jme3.cinematic.events.MotionTrack;

import com.jme3.material.Material;

import com.jme3.math.ColorRGBA;

import com.jme3.math.Vector3f;

import com.jme3.renderer.RenderManager;

import com.jme3.scene.Geometry;

import com.jme3.scene.shape.Box;

import com.jme3.system.AppSettings;

public class Main extends SimpleApplication {

MotionTrack motionControl;

MotionPath path;

float timer;

float delay;

float fps = 60;

public static void main(String[] args) {

Main app = new Main();

AppSettings settings = new AppSettings(true);






public void simpleInitApp() {

Box b = new Box(Vector3f.ZERO, 1, 1, 1);

Geometry geom = new Geometry(“Box”, b);

Material mat = new Material(assetManager, “Common/MatDefs/Misc/Unshaded.j3md”);

mat.setColor(“Color”, ColorRGBA.Blue);



timer = 0;

delay = 2;

//the path

path = new MotionPath();

path.addWayPoint(new Vector3f(0, 0, 0));

path.addWayPoint(new Vector3f(5, 0, 0));

path.addWayPoint(new Vector3f(0, 0, 0));

path.addWayPoint(new Vector3f(-5, 0, 0));


path.enableDebugShape(assetManager, rootNode);

motionControl = new MotionTrack(geom, path);





public void simpleUpdate(float tpf) {

//*** MotionTrack pause() test ****

if(motionControl.getPlayState() == PlayState.Stopped) motionControl.play();

if(timer < delay) {

timer += (float)1/fps;

if(motionControl.getPlayState() == PlayState.Playing) {




else if(motionControl.getPlayState() == PlayState.Paused) {



path.addListener( new MotionPathListener() {

public void onWayPointReach(MotionTrack control, int wayPointIndex) {

timer = 0;





public void simpleRender(RenderManager rm) {

//TODO: add render code




I tried a workaround with setting the MotionTrack’s speed at 0 then setting it at original value: the spatial doesn’t disapears but behavior is still strange.

Note: when no pause is attempted the path works just fine.

If someone have an idea.

I see no issue with your test case, however i’m running it against the very last SVN and there has been heavy changes on cinematics 2 days ago.

Could you try to use latest nightly and see if you still have the issue?

Thank you,

glad to know that my code works.

But I feel uncomfortable with all this nightly business.

I downloaded it and I actually don’t know where to put these files in. (I found a lib folder in jmonkeyplatform/platform but the rest of the content doesn’t fit the files tree…).

Unless someone is kind enough to answer such a noob issue I’d rather wait the next auto update.


I got the latest nightly now and you were right, it works.