I want the beam to only be a certain length, how would I go about doing so script wise
The only way, that I only know of, to constrain its length is to reposition one of the attachments:
local length = 10
local dir = (Attach1.WorldPosition - Attach0.WorldPosition).Unit
Attach1.WorldPosition = Attach0.WorldPosition + dir * length
Could you show me an example of this working in studio?
I put two attachments in the workspace and made a beam for them. Attachment1’s position is updated in a Heartbeat event and the length is 10 studs.
Could I see the script you used to get a better idea of how I may go about doing it for what Im trying to achieve
Setup:
Code used:
local baseplate = workspace.Baseplate
local attach0 = baseplate.Attachment0
local attach1 = baseplate.Attachment1
game:GetService("RunService").Heartbeat:Connect(function()
local length = 10
local dir = (attach1.WorldPosition - attach0.WorldPosition).Unit
attach1.WorldPosition = attach0.WorldPosition + dir * length
end)
1 Like
