2D - Flipping a sprite from a different position
Currently I am using this code to flip my character.
void Flip()
{
facingRight = !facingRight;
Vector3 scale = transform.localScale;
scale.x *= -1;
transform.localScale = scale;
}
However upon flipping my sprite it moves the character quite a bit. However i think this is because sprite in question is odd shaped.
![]()
As you can see the character is on the left side of the box and when flipped it jumps to the right. Now what I want to do is flip it based off the center of the actual character portion. Could someone clue me in how to do this?
NOTE: The reason the sprite is shaped funny is because he swings that big cross and it extends to fill the whole box. I got this off the Asset Store.
Your answer
Follow this Question
Related Questions
How do I stop an animation from looping? 1 Answer
How can I make player shoot in 2d with a joystick when we move the joystick out of its circuler area 0 Answers
Animation Script on GetKeyPressed 0 Answers
Factorio-like sprite directions 0 Answers
Player doesn't face the correct way in certain cases 0 Answers