Hot to rotate an object around an axis


#1

if the function takes an a parameter vector3(10f,30f,60f), I would to able to rotate the object 10 degrees about the x-axis, 30 degrees about the y-axis and 60 degrees about the z-axis.

How can I do this using the transform of the object?


#2

Something like this should do it:

public void RotateEntityByDegreesVector(Vector3 rotateBy)
{
	Entity.Transform.RotationEulerXYZ = new Vector3(
	  MathUtil.DegreesToRadians(rotateBy.X), 
	  MathUtil.DegreesToRadians(rotateBy.Y), 
	  MathUtil.DegreesToRadians(rotateBy.Z));
}