Ballistic Surfaces - Ricochet
Last updated
Last updated
Ricochet feature is extremely similar to the penetration feature. First, let's disable the penetration, but enable ricochet on our cube object.
The same principles apply as the penetration settings. The ricocheting bullet will lose it's kinetic energy based on the Energy Consumption. However, unlike penetration, the bullet will lose the energy only once, when it hits the object. So object's thickness play no role in here. Now, let's move our cube in X axis by 2 units, so it's position will be 2,2,10. Then rotate the cube on Y axis by 45 degrees so it's rotation will be 0,45,0. If you take a shot now, you will see the bullet ricocheting off the surface.
By changing Deflection Angles to a range between 10-20, we will get randomly deflecting bullet rays after ricocheting off the surface.
By playing with the values, you can create a penetrable/ricochet-able surface of your liking. You can take a look at the presets included to learn how to simulate some common surfaces.
If you want to use both penetration and ricochet at the same time on the same object, you should know that the system always favors penetration over ricochet. So a bullet ray hitting a surface, will first check if the object will have BallisticSurface.cs script on it. If so, it will FIRST check whether the penetration is enabled or not, and whether the current energy values allow penetrating the object. If that fails, ONLY THEN the ricochet settings are checked.