But I do not know how to make a beam that updates as fast as it can reflect from 2 mirrors.
How would I do this?
local LaserProjector = script.Parent.Parent
local BeamsFolder = LaserProjector:WaitForChild("Beams")
local function reflect(lv, nv)
return lv - 2 * nv * (lv:Dot(nv))
end
local Laser = {}
Laser.__index = Laser
function Laser:New(MaxDistance: number, Radius: number, MaxReflections: number)
local self = setmetatable({}, Laser)
self.MaxDistance = 100 or MaxDistance
self.Radius = 0.05 or Radius
self.MaxReflections = 50 or MaxReflections
return self
end
function Laser:Fire(originPart: BasePart)
--fire the beam
end
function Laser:Clear()
BeamsFolder:ClearAllChildren()
end
return Laser
The end result should become something like this, i’m making a laser projector but overkill. The mirrors will move VERY FAST and it will look like its a stable image.
You should use raycast reflection, as that is the best way to create such a beam.
Since you need it to be performant I recommend using a part cacheing system. This is one of the best ones readily available.
However, if you are trying to say that you don’t want to create a new beam every time it updates then that can be done as well. What you would need to do is store the parts used in the initial beam in an array by the order of reflection. What I mean by the order of reflection is that the first laser beam is added to the array first, then the next reflected part and so on. Then, when you want to update the beam you can have a function to update it. This function should take a direction (Vector3) value for the direction you want to the initial beam to travel. Then you update the direction the initial beam fires from and recalculate all the other beams positions.
i changed my mind, you cant make a laser projector like this with a single part, you would need like 158258125812861681269129698126892169961969126912901260912612681269 fps
You don’t, but Roblox staff do. All you have to do if flag your own post, set the reason to “Something else” and then provide the reason why and ask them to flag it.