Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

How do i make a solid ray reflect of objects at 90 degrees?

Asked by 8 years ago

Hello i've been at this for a while now to little success. I want to have a raycast hit a block and reflect of it at 90 degrees. Below is the current mess of code i've come up with but it does not work as intended.

01local function createBeam(part, point, surfacePoint)
02    print(part.Position)
03    if surfacePoint then
04        print(surfacePoint)
05          ray = Ray.new(point, surfacePoint * Vector3.new(1000,1000,1000))
06    else
07        print("no sp")
08          ray = Ray.new(point, part.CFrame.lookVector * Vector3.new(1000,1000,1000))
09    end
10    local newPart, newPoint, newSurfacePoint = workspace:FindPartOnRay(ray)
11 
12    local beam = Instance.new("Part", workspace:WaitForChild("Beams"))
13    beam.BrickColor = BrickColor.new("Bright red")
14    beam.FormFactor = "Custom"
15    beam.Material = "Neon"
View all 32 lines...

1 answer

Log in to vote
1
Answered by 8 years ago

I can't help you with this one but the user Egomoose wrote an article that might interest you. http://wiki.roblox.com/index.php?title=Dot_product

Ad

Answer this question