Jump to content
  • Advertisement
Sign in to follow this  
Alfederate

Raycasting Bullet Penetration?

This topic is 831 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

Hello, in my game I'm trying to implement bullet penetration through objects using raycasting. mjiprTH.png

 

The elements I know how to determine are the Start Point, Enter Point, and Surface Normal. The problem I have is how to find the Exit Point. With that I can calculate the Depth/Penetration Distance and continue the ray in the same direction. Does anyone know how I can find the Exit Point, knowing the direction of the ray, enter point, surface normal, and size and position of the object? I appreciate any help.

Share this post


Link to post
Share on other sites
Advertisement

How are you doing the ray-casting? You just want to issue a ray-cast query that finds all collisions along the ray instead of just the first one.

 

Alternatively, after finding the "enter point" collision, start 2nd ray cast from that position in the same direction (or offset along the ray direction by some small bias value), and you'll get the exit point collision. Then start a 3rd cay cast from that position in the same direction to continue the bullet's path.

Share this post


Link to post
Share on other sites

How are you doing the ray-casting? You just want to issue a ray-cast query that finds all collisions along the ray instead of just the first one.

 

Alternatively, after finding the "enter point" collision, start 2nd ray cast from that position in the same direction (or offset along the ray direction by some small bias value), and you'll get the exit point collision. Then start a 3rd cay cast from that position in the same direction to continue the bullet's path.

 

With the engine I'm using, the only thing the ray does is cast from A to B, returning position and surface normal of the object it hit, but only detecting if it hit the outside of the object.

 

However, I did manage to fix the problem by surrounding the block with invisible plates which the ray hit and determined the exit point.

 

Thank you for the help  :wink:

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!