- Home /
Change Rotation Pivot without Affecting Position
Is there a way to change the pivot of a sprite so that it will rotate from that point without making the position correspond to that pivot?
like, the position of the sprite is a characters feet, but you want to rotate him around his hips?
Yes, but with the position being the center of the sprite. And also, this is for a single sprite, if I wasn't clear.
Answer by highpockets · Apr 12, 2019 at 07:18 PM
Have you looked at RotateAround()?, you can rotate around a point in space on the z axis
transform.RotateAround(Vector3.zero, Vector3.forward, 20 * Time.deltaTime); //rotates 20 degrees a second around the z axis at the world origin
Does it work exactly the same as changing the pivot on the sprite?
It is effectively acting as your rotation pivot. It will change the object’s location and rotation unless RotateAround() is set to the origin of the transform at which point it just rotates around itself and does not affect the position at all