Creating a 2D Line Branch
Posted
by
Danran
on Game Development
See other posts from Game Development
or by Danran
Published on 2012-04-14T16:57:50Z
Indexed on
2012/04/14
17:42 UTC
Read the original article
Hit count: 265
I'm looking into creating a 2D line branch, something for a "lightning effect". I did ask this question before on creating a "lightning effect" (mainly though referring to the process of the glow & after effects the lightning has & to whether it was a good method to use or not); Methods of Creating a "Lightning" effect in 2D
However i never did get around to getting it working. So i've been trying today to get a seconded attempt going but i'm getting now-were :/.
So to be clear on what i'm trying to-do, in this article posted; http://drilian.com/2009/02/25/lightning-bolts/
I'm trying to create the line segments seen in the images on the site. I'm confused mainly by this line in the pseudo code;
// Offset the midpoint by a random amount along the normal.
midPoint += Perpendicular(Normalize(endPoint-startPoint))*RandomFloat(-offsetAmount,offsetAmount);
If someone could explain this to me it would be really grateful :).
© Game Development or respective owner