Turn around static axes

Hello everyone, I’m new in JME
I have a question about a turn around static objects axes. How do you know when you turn the object returned not himself, and his system of coordinates. This causes some difficulties in subsequent turns. Can rotate relatively static axles - I tried this:
1 - Get the position of the coordinate system relative to the global coordinate system
2 - Create on the basis of these data vector
3 - Return of the vector around our facility
I did this not happen. Can anyone give an example of such a code.
I want to make the game like this qblox 80level 240x320 - YouTube - can have a lighter version of its implementation?
Sorry for my English :slight_smile:

If it were me, I’d keep yaw, pitch, and roll separate as part of my game object. Movement would just be changing one of those values.

These can be trivially recomposed into a rotation: new Quaternion().fromAngles(pitch, yaw, roll) for applying to the Spatial (which is different and than the game object as it’s just the visual representation of it).

I do not quite understand what you mean. At first I tried to keep information about the coordinate system in the form of Euler angles, but faced with a hinged lock. It would be nice if you provided the appropriate code - it is easier to understand than words.

Yeah, it occurs to me that you don’t even need to keep track of all of that. Each ‘rotation’ is just an animation and then stays fixed. So any modifications of yaw, pitch, or roll can be done just during the roll and multiplied by whatever rotation already exists.

Unfortunately, I can’t provide code (at least not for free) because my time is too overbooked. Maybe someone else is willing to volunteer their time.

Cheers, I finally solved the problem and wrote rotation method - can someone needed.

import com.jme3.math.*;
import com.jme3.scene.*;

public class Rotator {

public static void rotate (Spatial spatial, Quaternion quaternion) {

Node node = new Node();
node.rotate(quaternion);

Transform transform = new Transform();
transform.set(spatial.getLocalTransform());
transform.combineWithParent(node.getLocalTransform());

spatial.setLocalTransform(transform);

}

public static void rotate (Spatial spatial, int axis, float angle) {

Node node = new Node();

Quaternion quaternion = new Quaternion();
Vector3f rotate_axis = Vector3f.ZERO;

switch (axis) { case 0: rotate_axis = Vector3f.UNIT_X; break;
                case 1: rotate_axis = Vector3f.UNIT_Y; break;
                case 2: rotate_axis = Vector3f.UNIT_Z; break; }

quaternion.fromAngleAxis(angle, rotate_axis);
node.rotate(quaternion);

Transform transform = new Transform();
transform.set(spatial.getLocalTransform());
transform.combineWithParent(node.getLocalTransform());

spatial.setLocalTransform(transform);

}

}