- Home /
2D Sprite Character Sprite PNG Excess Space
Hi,
I'm hoping somebody can help?
I have a 2D character sprite which is already cropped but has lots of excess space around the character.
This excess space seems to be interacting with game objects (example, I can't go flush against the wall) . Even though I have a bock collider around the character the collision seems to happen with the edge of the PNG image and not the actual collider.
Should I recreate a Sprite sheet and bring it into Unity to crop properly (as to leave no negative/excess space) or is there an easier and quicker way to do this.
I have tried to re crop with the sprite editor but it doesn't seem to make the changes to the sprite.
Ant help or direction would be great.
Thank you.
Answer by kortexx007 · May 03, 2020 at 12:18 AM
Update for anybody having the same issues.
It turns out that the box collider was working fine. The problem was with the flip.x of the sprite. Facing the right side, the Sprite and collider behaved as expected. But when facing the left, the sprite would flip on the x axis but the collider was not flipping with the sprite.
I have updated the sprites character script from flip.x = true, to transform.localScale = new Vector3(-1, 1, 1). When facing the right I have used transform.localScale = new Vector3(1, 1, 1).
I hope this works throughout the prototyping phase and doesn't come to bite my in the backside later :)
Your answer
Follow this Question
Related Questions
2D Sprite blocks onPointerClick? 0 Answers
Gaps in sprites 0 Answers
2D Undertale like Cutscenes / Animations,2D Undertale type cutscenes / animations. 0 Answers
Is tilemap renderer sorting done by camera y position? 0 Answers
Best approach for 2d animation to interact with the environment? 0 Answers