legospore
|
  |
| Joined: 19 Jul 2016 |
| Total Posts: 242 |
|
|
| 09 Aug 2017 12:04 AM |
I have this script inside of a part, and when I run the game, the first ray works just fine, but rather than reflecting properly, it just keep going straight. No errors, what am I doing wrong?
local me = script.Parent
function reflect(input, normal) return input-(2 * input:Dot(normal) * normal) end function fire(a,b,limit) local limit = limit or 0 if limit <= 5 then local calc = Ray.new(a,face*100) hit,pos,normal = game.Workspace:FindPartOnRay(calc) local ray###R#y##############local dist = (a-pos).magnitude beam = In####################### #e######### "Laser" beam.Transparency = .75 beam.Material = "Neon" beam.BrickColor = BrickColor.new("Really red") beam.Anchored = true beam.CanCollide = false beam.Size = Vector3.new(.2,.2,dist) beam.CFrame = CFrame.new(pos,startPos) * CF####################### game:GetService("Debris"):AddItem(beam, 2) local ref = reflect((pos-a),normal)*100 print(normal) print(ref) if hit then fi#########o########imit+1) end end end while true do face = me.CFrame.lookVector startPos = me.Position + (face*me.Size.z/2) fire(startPos,face*100) wait(2) end |
|
|
| Report Abuse |
|
legospore
|
  |
| Joined: 19 Jul 2016 |
| Total Posts: 242 |
|
|
| 09 Aug 2017 12:05 AM |
| this filter is out of hand |
|
|
| Report Abuse |
|
| |
legospore
|
  |
| Joined: 19 Jul 2016 |
| Total Posts: 242 |
|
|
| 09 Aug 2017 12:09 AM |
| ############################# |
|
|
| Report Abuse |
|
legospore
|
  |
| Joined: 19 Jul 2016 |
| Total Posts: 242 |
|
| |
legospore
|
  |
| Joined: 19 Jul 2016 |
| Total Posts: 242 |
|
| |
Exzeption
|
  |
| Joined: 01 Nov 2011 |
| Total Posts: 1312 |
|
|
| 09 Aug 2017 02:05 AM |
silly mistakes
line 9 replace face with (b-a)
line 21 replace startPos with a |
|
|
| Report Abuse |
|