- Home /
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 =)
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
Haha, that's silly. :) If you make your discovery into an answer, I'll upvote it.
Good idea, that should help others find this in the future
Answer by Rellik · Oct 31, 2011 at 02:13 PM
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
Answer by djarcas · Mar 23, 2013 at 03:47 PM
It appears that the function now takes radians, not degrees. However, the documentation still says it's in degrees...!
Answer by ForceMagic · Jan 12, 2016 at 05:51 PM
In Unity 5.2, 3 it has been fixed Transform.RotateAround angle parameter is really in degrees.
While, RotateAround overload without Point parameter is now deprecated.
Your answer
Follow this Question
Related Questions
Sprite doesn't flip correctly. 1 Answer
Problem with Clamping Values for Object's Rotation 1 Answer
Calc 30° left and x units forward from local forward axis 1 Answer
Follow x rotation of a target object. 1 Answer
Phantom Axis Movement 0 Answers