badfitz67
|
  |
| Joined: 03 Jun 2010 |
| Total Posts: 13165 |
|
|
| 31 Oct 2015 06:17 PM |
So I've made the initial "trunk" of the lightning, now how would I make branches that have their own "tree" for i = 1, 20 do lightning = Ray.new(nextpoint,nextpoint2) lightning_trace(nextpoint,nextpoint2) nextpoint=nextpoint2 nextpoint2 = Vector3.new(nextpoint.X+math.random(-5,5),nextpoint.Y-math.random(5,15), nextpoint.Z+math.random(-5,5)) local startbranch = nextpoint2 local branch = Vector3.new(nextpoint2.X+math.random(-5,5),nextpoint2.Y-math.random(5,15),nextpoint.Z+math.random(-5,5)) lightning = Ray.new(startbranch,branch) lightning_trace(startbranch,branch) end
You really want me to shake your hand? |
|
|
| Report Abuse |
|
badfitz67
|
  |
| Joined: 03 Jun 2010 |
| Total Posts: 13165 |
|
|
| 31 Oct 2015 06:26 PM |
lightning_ray = function(p1, p2) local lightning = Ray.new(p1,p2) local hit,endp = workspace:FindPartOnRay(lightning) lightning_trace(p1,p2) local nextpoint = Vector3.new(p1.X,p2.Y,p1.Z) local nextpoint2 = Vector3.new(p1.X+math.random(-5,5),p2.Y-math.random(5,15),p1.Z+math.random(-5,5)) local startbranch = nextpoint2 local branch = Vector3.new(nextpoint2.X+math.random(-5,5),nextpoint2.Y-math.random(5,15),nextpoint.Z+math.random(-5,5)) for i = 1, 20 do startbranch = startbranch branch = branch lightning = Ray.new(nextpoint,nextpoint2) lightning_trace(nextpoint,nextpoint2) nextpoint=nextpoint2 nextpoint2 = Vector3.new(nextpoint.X+math.random(-5,5),nextpoint.Y-math.random(5,15), nextpoint.Z+math.random(-5,5)) lightning = Ray.new(startbranch,branch) lightning_trace(startbranch,branch) startbranch = nil startbranch = branch branch = nil branch = Vector3.new(startbranch.X+math.random(-5,5),startbranch.Y-math.random(5,15),startbranch.Z+math.random(-5,5)) end end
print(lightning_ray(Vector3.new(0, 250, 0),Vector3.new(0, 240,0)))
I currently have that. But how would I make branches come off every single segment of the main bolt
You really want me to shake your hand? |
|
|
| Report Abuse |
|