Confused about Euler axes and JME axes

Hi,

I’m quite confused about yaw, pitch and roll in JME. I learned that the Euler axes are like its shown in this picture:



Pitch: Rotating around the X-Axis

Yaw: Rotating around the Y-Axis

Roll: Rotating around the Z-Axis



But if i build a basic project with a rotating box, it has a different effect than expected.



[java]package mygame;



import com.jme3.app.SimpleApplication;

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.Spatial;

import com.jme3.scene.shape.Box;



public class Main extends SimpleApplication {



Box b;

Spatial geom;



public static void main(String[] args) {

Main app = new Main();

app.start();

}



@Override

public void simpleInitApp() {

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

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



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

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

geom.setMaterial(mat);



rootNode.attachChild(geom);

}



@Override

public void simpleUpdate(float tpf) {

//TODO: add update code

geom.rotate(2 * tpf, 0, 0);

}



@Override

public void simpleRender(RenderManager rm) {

//TODO: add render code

}

}

[/java]



In the Javadoc of the Spatial class, the method rotate() is defined as: [java]rotate(float yaw, float roll, float pitch)[/java]



But in the test example the box is rotating around X-Axis. (As shown in the first image on this page: https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:math)



I hope someone can enlighten me :confused:

The labels in these methods are incorrect.



It would be better if they were written:

rotate( xAxis, yAxis, zAxis )



In other words:

rotate( pitch, yaw, roll )



This is pretty widespread as it affects Quaternion.fromAngles(), etc. also. I don’t know why it hasn’t been fixed yet but at the same time, I haven’t bothered to fix it myself either. :slight_smile:

1 Like

Wow, what fast anwser. That makes everything clear. Thanks :smiley:

I committed a fix for this