Change rotation center inside script

Hi everybody. Does somebody know how to set center of object rotation from inside script? I have got a level and a ball inside. I need to rotate the level around the ball. Thank you for your tips.

Can you elaborate on the shape of level and its distance from ball? or rather your setupr of level and ball.

–

2 Answers

2

You can use RotateAround method to rotate your level around the ball.

transform.RotateAround(ball.transform.position, axis, speed * Time.deltaTime);

where axis is the axis of rotation, you can use Vector3.up, Vector3.down, Vector3.fwd etc.

Rotate Around…?

http://docs.unity3d.com/ScriptReference/Transform.RotateAround.html

–