1
\$\begingroup\$

I 'built' (followed a tutorial) on a collision detection system, and when I flip the object to go left and right the collision messes up. So I have three options; find a way to modify the collision detection, have sprites for all animations for left and right or to flip the sprite but no the object.

if anyone has used RaycastHit2D, and has figured out a way to do it correctly, that would also be great.

\$\endgroup\$
  • \$\begingroup\$ You haven't actually explained what your problem is. In any case, collision detection is already built into Unity, so why are you re-implementing it? \$\endgroup\$ – Cubic Aug 29 '15 at 3:57
  • \$\begingroup\$ when I flip the object to go left and right the collision messes up. I am looking for a way to flip a sprite without flipping the game object it is attached to. \$\endgroup\$ – bob Aug 29 '15 at 21:59
3
\$\begingroup\$

You can attach the sprite to the child of the main game object which handles the collision detection logic. Whenever you want to flip the sprite just do it on the child object leaving the main object as it is. This way you can achieve your desired result :)

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.