I was just playing around with RotateAround function and i have a doubt regarding the first parameter i.e.
point : Vector3 .
I tried snippets of code like :
1)transform.RotateAround(Vector3.right * 10, Vector3.right, Time.deltaTime * 10);
2)transform.RotateAround(Vector3.up * 10, Vector3.right, Time.deltaTime * 10);
I didn’t seem to understand anything apart from the cube rotating and revolving.
Vector3.right * 10 mean position multiplied by 10 units in ‘x’ direction ?
I added another cube as a target cube and rotated around its position. Then the cube was revolving around the target as well as rotating which was pretty much what i expected.
Can anyone explain what is happening in the 2 code snippets i have written above ?
well i didn’t get what you really mean , but as i get 50% of it , when you write this line every object in the screen or game level spin…
if this script doesn’t work (by any problem) that’s because you don’t use it in a correct place… first of all read the manual of this function then use it … as you see :
"Rotates the transform about axis
passing through point in world
coordinates by angle degrees. This
modifies both the position and the
rotation of the transform. "
as you see you should use other functions… if you want your object rotate in one axis then use Transform.Rotate … for example if you want to spin the object that the script is attached to to x axis multiplied by 10 then use this script :
transform.Rotate(Vector3.right *10 * Time.deltaTime);
hope that will solve ur problem…