- Home /
How do I rotate in the center after changing the position of the pivot?
I'm making a 2d tower defense game, and I changed the pivot of a tower so that I can set in the area I selected, but the problem is the tower doesn't rotate correctly. It's supposed to rotate in place, not around it. Is there a way I can set the tower in the correct place and have it rotate from the center?
The problem is occurring because you changed its pivot. Objects rotate around their pivots, but why are you having trouble placing the tower? Is the tower offset from the location you want it to be instantiated in?
Yes, I want it so that it's placed on the center of the tile I choose, but it's placed on the top-left of it. How do I fix that?
Are you using the tile's position to place the tower? If so, you may have altered the tile's pivot point and that's what may be causing the issue.
Answer by RelayRay · Nov 14, 2020 at 04:21 PM
Maybe try setting the rotation like gameobject.transform.rotation = Quaternion.Euler(x, y, z);