How do I add a Rigid body and a box collider component to a Texture2D?

Posted by gamenewdev on Game Development See other posts from Game Development or by gamenewdev
Published on 2014-03-26T09:09:47Z Indexed on 2014/08/24 4:34 UTC
Read the original article Hit count: 213

Filed under:
|

I am making a snake game. I'm basing it on a basic tutorial game, which does no collision detection, wall checking or different levels.

All snake head, piece, food, even the background is made of Texture2D. I want the head of the snake to detects 2D collisions with them, but Rect.contains isn't working. I'd prefer to detect collisions by onTriggerEnter() for which I need to add BoxCollider to my snakeHead.

© Game Development or respective owner

Related posts about unity

Related posts about collision-detection