Ray and Rectangle Collision
I am currently making a basic 2D game and need to determine when a ray (your sprite's laser) collides with a rectangle (the enemy). I also need it to determine which rectangle the ray collides with first and have it return to me the point where the ray and the edge of the rectangle intersect.
I would like to know if there is a simple method to calculate this and what the process is for checking this single type of collision as in my game, no other collisions are taken into account.
Thanks in advance for your help.
Hello,
have a look at line clipping
http://en.wikipedia.org/wiki/Line_clipping
that should get you started
have a look at line clipping
http://en.wikipedia.org/wiki/Line_clipping
that should get you started
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement