- Home /
Rotating a 2D sprint IN THE CENTER in 4.3
Hello everyone!
I have a question in regards of what I am trying to do.
I want to rotate a waterdrop sprite, but I want to have it rotate not around the axis of the game, but the center axis of the water drop sprite itself. I know that normally that I'd have to have a collider in a 3D object in order to rotate an object in the center, but since its in 2D, that doesn't seem to be the case. Is there a way to do it in the 2D setting?
Any input is gladly appreciated.
Answer by Eric5h5 · Dec 28, 2013 at 06:28 AM
Use Transform.Rotate; whether it rotates around the center depends on where you put the pivot point. You never need a collider in order to rotate objects, 3D or otherwise.
Ok so I do that, but how do I make the pivot point at the center of the sprite? I used Vector3D.forward and Vector3D.back in that function before and it rotates around a axis, but not on the center of the sprite like I wanted to.
Set the pivot point in the inspector, using the pivot drop-down.
So I managed to get that fixed. I got it accomplished by making a empty game object, making it the child of the object that I'm trying to rotate, and put it where I wanted the object to pivot at and did the rest in code. Thanks a bunch for setting that idea in motion!
It would be a lot easier if you just set the pivot point in the inspector.