Hello Im going to have 2 spawns 1 on one side, 1 on the other indicated with the red line.
How could i size the barrier the read brick under the orange spawn to the length to the second spawn.
I need this because length between Spawn1 and Spawn2 might not always be the same.
But i want to cover the spawns.
Green = The size i want automatically.
Red = The randomly placed second spawn.
Couldn’t you estimate the distance by rounding the number?
You will need to first place the first spawn so that you have a position. Then find the distance between them by doing
(spawn2.Position - spawn1.Position).Magnitude). This gives you the distance between them. With that info, you can now place the red brick by first setting its size to the distance between them (This will be from the midpoint of the spawn to the midpoint of the other spawn. If you want it to go to both ends, then you need to add
spawn.Size.X * 2(may be Z based on how you set it up) to the value) The size will be set by setting the size of the red part to
Vector3.new(1, 1, mag)(or any other number instead of one). For the positioning, you can just get the offset from the two,
spawn2.CFrame:ToObjectSpace(spwan1.CFrame) and then setting the position of the red brick to
spawn2.CFrame.Position + spawn2.CFrame:ToObjectSpace(spwan1.CFrame).Position. Or you can just set the CFrames instead of position.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.