How do i make a solid ray reflect of objects at 90 degrees?
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.
01 | local function createBeam(part, point, surfacePoint) |
05 | ray = Ray.new(point, surfacePoint * Vector 3. new( 1000 , 1000 , 1000 )) |
08 | ray = Ray.new(point, part.CFrame.lookVector * Vector 3. new( 1000 , 1000 , 1000 )) |
10 | local newPart, newPoint, newSurfacePoint = workspace:FindPartOnRay(ray) |
12 | local beam = Instance.new( "Part" , workspace:WaitForChild( "Beams" )) |
13 | beam.BrickColor = BrickColor.new( "Bright red" ) |
14 | beam.FormFactor = "Custom" |
15 | beam.Material = "Neon" |
16 | beam.Transparency = 0.25 |
19 | beam.CanCollide = false |
21 | local distance = (point - newPoint).magnitude |
22 | beam.Size = Vector 3. new( 0.3 , 0.3 , distance) |
23 | beam.CFrame = CFrame.new(point, newPoint) * CFrame.new( 0 , 0 , -distance / 2 ) |
27 | createBeam(newPart, newPoint, newSurfacePoint) |