How to get a sprite to rotate to the closest side?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By BlockOG

I’ve got a square with a collision. When the square jumps the sprite turns in the air but the collision doesn’t. When it lands the rotation of the sprite just turns to zero but I want it to turn pretty fast to the closest side. How do I do that?

Hero do you have the collision setup? What is turning when the square jumps? Is the collision a child of the main character node?

Ertain | 2020-12-09 19:30

:bust_in_silhouette: Reply From: Annoying_Brother

Rotate to closest side?
You should have x </> and then rotation.x = 180/-180
Also calculate the center of where the player is and idk how to do that but I think you can.
Hope this helps!

My project is 2D not 3D
And the center is literally the sprite’s position or the collision’s position, they’re the same

BlockOG | 2020-12-11 13:39

Do you mean the “center” the center above the corner or the center of the player itself?

BlockOG | 2020-12-11 13:50