How does the unity rotate tool rotate around the local y axis? It seems that if I try to adjust localEulerAngles.y programmatically, we do not get the same effect. When rotating with the local rotate tool, x, y and z values are changed.
How can we rotate a transform around its local y axis?
4 Answers
4
the space parameter is what you need:
transform.Rotate(0, yAmount, 0, Space.Self);
transform.RotateAround(transform.position, transform.up, Time.deltaTime * 90f);
Try this:
void Update()
{
transformRotateAround(transform.position, TransformDirection(Vector3.up), Time.deltaTime * 90f);
}
private void Update()
{
transform.Rotate(0, 0, 10 * Time.deltaTime);
}
http://docs.unity3d.com/Documentation/ScriptReference/Transform-rotation.html http://docs.unity3d.com/Documentation/ScriptReference/Transform.Rotate.html
– AlucardJaySay you wanted a Transform to Look (or point) towards a vector, while being constrained by the local y axis. How can that be achieved?
– absameen