# Raycasting Bullet Penetration?

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

## Recommended Posts

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

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 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.

##### 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:

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 10
• 11
• 13
• 9
• 9
• ### Forum Statistics

• Total Topics
634087
• Total Posts
3015416
×