Game Development Community

Calculating the angle of impact

by David Boyd · in Torque Game Engine · 02/09/2008 (6:33 am) · 1 replies

Hey folks,

Could anyone recommend a method for calculating the angle at which a project hits an object, ideally to the face on the object that it hits. I've tried a couple of things but haven't had much success.

Any suggestions would be greatly appreciated!

#1
02/09/2008 (12:54 pm)
It is hard to do much through script because the velocity state is zeroed on collision. I ended up changing the code to store the velocity state frequently so there was one left over after collision. You would likely have to save the normal of the collision surface as well or the entire face if you desired.

Note that some objects use simplified collision surfaces (players and vehicles, for example), so what your projectile hits isn't the same as the polygons you see. Check out various "melee" resources to see what you can do in modifying that.