x


Rotate Around Local Y Axis

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?

more ▼

asked Jul 23 '12 at 02:35 PM

absameen gravatar image

absameen
444 50 78 88

Say you wanted a Transform to Look (or point) towards a vector, while being constrained by the local y axis. How can that be achieved?

Jul 23 '12 at 02:47 PM absameen
(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first
transform.RotateAround(transform.position, transform.up, Time.deltaTime * 90f);
more ▼

answered Jul 23 '12 at 06:21 PM

ScroodgeM gravatar image

ScroodgeM
7.6k 2 6

transform.up is actually world axis up right?

Jun 03 at 08:38 AM ina
(comments are locked)
10|3000 characters needed characters left

Try this:

void Update()
{
    transformRotateAround(transform.position, TransformDirection(Vector3.up), Time.deltaTime * 90f);
}
more ▼

answered Jun 03 at 09:36 AM

Shgoedt gravatar image

Shgoedt
56

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x747
x329
x139
x44

asked: Jul 23 '12 at 02:35 PM

Seen: 4548 times

Last Updated: Jun 03 at 09:36 AM