[diff for Spatial] New method Spatial.setLocalRotation(xAngle, yAngle, zAngle)

I have always wondered why this function never existed and have wanted it on many occasions. It does the same as setLocalRotation(Quaternion) except does not require explicit creation of a Quaternion object. Also added that the order of rotations is: y, z, x.



[patch]

— Base (BASE)

+++ Locally Modified (Based On LOCAL)

@@ -806,6 +806,23 @@

}



/**

  • * &lt;code&gt;setLocalRotation&lt;/code&gt; sets the local rotation of this node<br />
    
  • * using euler angles. Note: the order of rotations will be: y, then z and then x<br />
    
  • *<br />
    
  • * @param xAngle<br />
    
  • *            the Euler pitch of rotation (in radians)<br />
    
  • * @param yAngle<br />
    
  • *            the Euler yaw of rotation (in radians)<br />
    
  • * @param zAngle<br />
    
  • *            the Euler roll of rotation (in radians)<br />
    
  • */<br />
    
  • public void setLocalRotation(float xAngle, float yAngle, float zAngle) {
  •    Quaternion quaternion = new Quaternion().fromAngles(xAngle, yAngle, zAngle);<br />
    
  •    localTransform.setRotation(quaternion);<br />
    
  •    setTransformRefresh();<br />
    
  • }

    +
  • /**
  • <code>getLocalScale</code> retrieves the local scale of this node.

    *
  • @return the local scale of this node.

    [/patch]

I don’t know if this bloats the API or not and will let others judge… but I don’t like the code for another reason.



It should instead be:

[java]

public void setLocalRotation(float xAngle, float yAngle, float zAngle) {

setLocalRotation(new Quaternion().fromAngles(xAngle, yAngle, zAngle));

}

[/java]



…and the javadoc should probably link to Quaternion fromAngles since that’s all this simple convenience method does.

This implies Euler rotations, I don’t like that since rotation order matters then.