Jump to content
  • Advertisement
Sign in to follow this  
VISQI

Lazer Collision detection...

This topic is 2501 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey
So, in my project, the AI are shooting lazers to the player(an ellipsoid).
What is the way to know if the lazer is actually shooting at the player??
I thought of making an AABB for the lazer but the didn't go well because it showed collisions when the lazer wasn't near the player.
Should i make a cylindrical Bounding Shape instead?? if so, what is the intersection test between a cylinder and an ellipsoid??

Share this post


Link to post
Share on other sites
Advertisement
Hey

Is it possible to use a line intersection for the laser?
if so you could simplify the intersection test to sphere vs ray and just limit the intersection to the length of the line.

if you transform the ray by the inverse of the sphere matrix you can test for ellipsoid aswell.

Intersection between sphere and ray can be googled and its a very simple test.

Share this post


Link to post
Share on other sites

Hey

Is it possible to use a line intersection for the laser?
if so you could simplify the intersection test to sphere vs ray and just limit the intersection to the length of the line.

if you transform the ray by the inverse of the sphere matrix you can test for ellipsoid aswell.

Intersection between sphere and ray can be googled and its a very simple test.


I thought of this, but my lazer is more like cylindrical shape with a radius of 0.5 rather than a ray...
Just one thing, by the sphere matrix you mean the matrix consisting of the right,up,look vectors(x,y,z), right??

Share this post


Link to post
Share on other sites
We use GJK for collision.

We typically search for the closest, or a sufficiently close solution.

In your case we would be ray casting against the convex shape (the ellipsoid). The ray being the center of the laser.
We would solve for the closest solution. This would be a point on the laser ray that was as close to the ellipsoid as possible.

If that point was not more than the laser's radius away from the ellipsoid then it would be considered a hit.

This is basically the method:
http://www.continuousphysics.com/ftp/pub/test/physics/papers/jgt04raycast.pdf

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!