- Home /
Flip box collider and sprite
I am making my first game, which is a 2d platformer, and want for the character to flip when they are moving each direction. This was working fine with transform.eulerAngles or transform.localScale, but then I realized that the rotation is moving the sprite, and makes it glitch into walls it is standing beside. I tried to use flipX, but the Box Collider doesn't flip. After a lot of digging, I found out that I should try to change the pivot point using the sprite editor, but the sprite editor doesn't appear for my character. If anyone has an answer to any of these problems, it would be greatly appreciated. Thank you!
Answer by Waterpolo7 · Dec 26, 2021 at 01:52 PM
Hi @flyingchicken22,
you probably haven't got the Sprite 2D package installed, which isn't by default. Here's how you should do it:
1) Go to Window > Package Manager
2) At the top you select Package: Unity Registry
3) Now you search for the Sprite 2D package, and you download it.
4) Go back to your editor, and click on an imported sprite in your assets (not your hierarchy).
5) In the Inspector you click the button which says Sprite Editor
6) Now you're able to edit the pivot of your sprite, which should probably be centered in your case.
I hope this works, let me know :)
It seems that I misdiagnosed the problem, because your solution worked but the sprite pivot point was already set to center. I have no idea why this is happening at this point. Thank you for helping!
Your answer