generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: This script is supposed to reflect a ray, confusing result

Previous Thread :: Next Thread 
legospore is not online. 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 is not online. legospore
Joined: 19 Jul 2016
Total Posts: 242
09 Aug 2017 12:05 AM
this filter is out of hand
Report Abuse
WatermelonMan4676 is not online. WatermelonMan4676
Joined: 20 Jan 2014
Total Posts: 5516
09 Aug 2017 12:06 AM
Paste nib
Report Abuse
legospore is not online. legospore
Joined: 19 Jul 2016
Total Posts: 242
09 Aug 2017 12:09 AM
#############################
Report Abuse
legospore is not online. legospore
Joined: 19 Jul 2016
Total Posts: 242
09 Aug 2017 12:10 AM
#################
Report Abuse
legospore is not online. legospore
Joined: 19 Jul 2016
Total Posts: 242
09 Aug 2017 12:11 AM
w i 9 6 p 8 U t
Report Abuse
Exzeption is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image