Animating Translation, Rotation, etc

I’ve seen the tutorial on Animation, which is triggering animations from imported models, however I’m looking to animate the translation of a node - so that a node can move from (0, 0, 0) to (1, 0, 1) smoothly. Eventually I’ll be looking at the same thing for rotation.

Are there are any guides/tutorials on how best to do this with JME? Or is this just something I should implement however best suits my use case?

You mean like this?
https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:motionpath

Found in the “Animations and Scenes” section of this page:
https://wiki.jmonkeyengine.org/legacy/doku.php/jme3

Exactly like that! I didn’t spot that - I’ll have a play around, thanks! :slight_smile:

I was just looking at the test and have a question; how do motion events tie in with the update loop, or do they keep track of time themselves internally? In that test it doesn’t seem that the motion control is registered with anything that could tie it in with the update loop, but I suspect I’m missing something?

http://hub.jmonkeyengine.org/javadoc/com/jme3/cinematic/events/MotionEvent.html
…is a…
http://hub.jmonkeyengine.org/javadoc/com/jme3/scene/control/Control.html

…and my guess is it self-registers itself with the spatial in the constructor but you could look at the code if you really wanted to know. It’s only two or three clicks away from here.

Edit: fixed the link

I’m guessing you meant to link to:

http://hub.jmonkeyengine.org/javadoc/com/jme3/cinematic/events/MotionEvent.html

So yeah, it does (it calls spatial.addControl(this)) - which makes a lot of sense. My brain chews on these things if I can’t build a mental map of how they work, stops me getting anything done :wink: Thanks, much appreciated!

@ledneb said: I'm guessing you meant to link to:

http://hub.jmonkeyengine.org/javadoc/com/jme3/cinematic/events/MotionEvent.html

Yeah, not sure how that happened… anyway, I fixed the link.

MotionEvent can be used as a control on a spatial or as a cinematic event with a Cinematic.

You can also use spatial Animation for your purpose, look at the AnimationFactory class it provides convenient api to create a spatial animation for an object.