x


use world axis when using transform.rotate

Hello, all. I was wondering if there was a way for me to achive a transform.rotate function using the global/world axis, not the local. All help is appreciated.

more ▼

asked May 21 '11 at 11:03 AM

zmar0519 gravatar image

zmar0519
946 59 66 78

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

Yes, just add Space.World at the end (before the closing parenthesis and semicolon.)

more ▼

answered May 21 '11 at 11:27 AM

Muzz5 gravatar image

Muzz5
1.2k 68 83 94

Minor detail, but it'd actually be Space.World.

May 21 '11 at 11:33 AM Jesse Anders

Who said World.Space? And what's that suspicious looking edited thing?

May 21 '11 at 11:54 AM Muzz5

Lol...I must have misread! :-)

May 21 '11 at 06:31 PM Jesse Anders
(comments are locked)
10|3000 characters needed characters left

There is another argument that you can pass to Transform.Rotate that determines which space to use for rotating:

transform.Rotate( x , y , z , Space.World); //By default it is Space.Self and you do not need to include that value

or:

transform.Rotate( eulerAngles , Space.World); //Default  = Space.Self.

This is what Muzz5 said, but I wanted to add an example.

more ▼

answered May 21 '11 at 12:25 PM

Peter G gravatar image

Peter G
15.1k 16 44 137

(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:

x1332
x747
x329
x139
x127

asked: May 21 '11 at 11:03 AM

Seen: 2172 times

Last Updated: May 21 '11 at 06:31 PM