[solved] Remember previous Spatial position

Hi, I have a situation in my game when I have to remember position of my hero. After that I use lookAt function to change position of him. After some time I need to rotate him to the previous position. How to remember the angle of this rotation to push it back when I want? Thanks in advance.

With a variable?

But what “with a variable?”, the angle? I think I don’t understand.

Quaternion oldRotation = spatial.getLocalRotation().clone();

Please read these:

https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:scenegraph_for_dummies

https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:math_for_dummies

1 Like

Ok, thanks, it works nice :slight_smile: I will read this.