x


Transform.RotateAround(Vector3 axis, float angle) - what happens with only two arguments?

There are two ways to call Transform.RotateAround -

Transform.RotateAround(Vector3 point, Vector3 axis, float angle)
Transform.RotateAround(Vector3 axis, float angle)

The first way is documented in the manual and makes total sense. The second one is a complete mystery that is currently blowing my mind. Anybody have experience with this?

The following of my assumptions have turned out to be false:

  • It does not just default to "Vector3 point = Vector3.zero"
  • It does not just default to "Vector3 point = transfrom.position"
  • It does not even call the 3-argument version of Transform.RotateAround. In fact, the 3-argument version of Transform.RotateAround calls the 2-argument version after doing a position calculation.

I'm running out of ideas, and this is blocking me at the moment... I'd love to hear from anyone with any knowledge on this!

Thanks =)

more ▼

asked Oct 31 '11 at 01:54 PM

Rellik gravatar image

Rellik
46 1 1 2

The answer to this is just a ridiculous example of method overloading inconsistency. Here's what I just discovered:

Transform.RotateAround(Vector3 point, Vector3 axis, float angle)

^ takes radians.

Transform.RotateAround(Vector3 axis, float angle)

^ rotates around transform.position... and takes degrees

Oct 31 '11 at 12:13 PM Rellik

Haha, that's silly. :) If you make your discovery into an answer, I'll upvote it.

Oct 31 '11 at 01:55 PM CHPedersen

Good idea, that should help others find this in the future

Oct 31 '11 at 02:14 PM Rellik
(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

The answer to this is just a ridiculous example of method overloading inconsistency. Here's what I just discovered:

Transform.RotateAround(Vector3 point, Vector3 axis, float angle)

^ takes radians.

Transform.RotateAround(Vector3 axis, float angle)

^ rotates around transform.position... and takes degrees

more ▼

answered Oct 31 '11 at 02:13 PM

Rellik gravatar image

Rellik
46 1 1 2

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

It appears that the function now takes radians, not degrees. However, the documentation still says it's in degrees...!

more ▼

answered Mar 23 '13 at 03:47 PM

djarcas gravatar image

djarcas
16 4

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

x1887
x483
x407
x325
x136

asked: Oct 31 '11 at 01:54 PM

Seen: 2556 times

Last Updated: Mar 23 '13 at 03:47 PM