Original Post
Greetings, GameDev community!
I'm currently working with Box2D, and I'm implementing an explosion-effect.
Therefore, I'm in need of a direction vector to be multiplied by the force (which is based on distance).
In order to make it appear as seamless as possile, I need to first transform the vector so that the highest value of the vector is 1. Let me show you;
A vector of (15, 10) would be (1, 6.67). As would a vector (30,15) be (1, 0.5).
Has anyone done this before and have a code snippet to share? The general theory / principle behind it would be sufficient as well.
Thanks in advance
//pimms
I'm currently working with Box2D, and I'm implementing an explosion-effect.
Therefore, I'm in need of a direction vector to be multiplied by the force (which is based on distance).
In order to make it appear as seamless as possile, I need to first transform the vector so that the highest value of the vector is 1. Let me show you;
A vector of (15, 10) would be (1, 6.67). As would a vector (30,15) be (1, 0.5).
Has anyone done this before and have a code snippet to share? The general theory / principle behind it would be sufficient as well.
Thanks in advance
//pimms