I'm trying to set up a script for a bullet that can ricochet. It's working perfectly, except one thing. I want the bullet to bounce only if it strikes a glancing blow on an obstacle. For instance, if it hits an object straight on, it doesn't bounce. If the surface is more than say 70 degrees perpendicular to the bullet's trajectory, it does bounce.
I've messed with different ways of angle comparison and have not figured out how to do this.
Vectors available for this:
Bullet's current angle
Bullet's angle following a bounce
Normal of surface hit
Bullet's absolute velocity
Is there a function (or script) that simply examines two angles and gives me the total difference (a single number, not a vector) between them?