I want to create a Lightning Effect Like http://www.youtube.com/watch?feature=player_embedded&v=mmU2GAYGVSU for my game.
The following blog explains it briefly but I am not able to understand the following line:
midPoint += Perpendicular(Normalize(endPoint-startPoint))*RandomFloat(-offsetAmount,offsetAmount);
UPD: I went through older question posted at gamedev.stackexchange and found following explanation:
Normalize(endPoint-startPoint):
That line gets a unit vector (vector of length 1) from startPoint to endPoint
Perpendicular(Normalize(endPoint-startPoint))
then gets a vector perpendicular to that (i.e. at right angles to the line)
I want to know whether python has inbuilt function for
Getting a unit vector (vector of length 1) from startPoint to endPoint
Getting a vector perpendicular to that (i.e. at right angles to the line)