[Solved] Showing axis information for spatials and their rotation

Hi

Couldn’t find this, but is there any way to show axis (like x-y-z with red-green-blue f.x.) inside the game - to debug rotations and vectors?

Kind regards,
Asser

Theres an Arrow mesh that you can use for that purpose, yes.

1 Like

Just adding my solution:

private void putShape(Node n, Mesh shape, ColorRGBA color) {
    Geometry g = new Geometry("coordinate axis", shape);
    Material mat = new Material(this.getApplication().getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
    mat.getAdditionalRenderState().setWireframe(true);
    mat.setColor("Color", color);
    g.setMaterial(mat);
    n.attachChild(g);        
}

private void attachCoordinateAxes(Node n) {
    Arrow arrow = new Arrow(Vector3f.UNIT_X);
    arrow.setLineWidth(4); // make arrow thicker
    putShape(n, arrow, ColorRGBA.Red);

    arrow = new Arrow(Vector3f.UNIT_Y);
    arrow.setLineWidth(4); // make arrow thicker
    putShape(n, arrow, ColorRGBA.Green);

    arrow = new Arrow(Vector3f.UNIT_Z);
    arrow.setLineWidth(4); // make arrow thicker
    putShape(n, arrow, ColorRGBA.Blue);
}