Raycasting Bullet Penetration?

Started by
1 comment, last by Alfederate 8 years ago

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.

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.

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:

This topic is closed to new replies.

Advertisement