Hello,
I would like know how to connect cylinder at a Vector3 position to another Vector3 position because I don’t know enought maths to make this. Can you help me please?
Here is an exemple in 2D.
Hello,
I would like know how to connect cylinder at a Vector3 position to another Vector3 position because I don’t know enought maths to make this. Can you help me please?
Here is an exemple in 2D.
You can just construct a CFrame using the CFrame constructor CFrame.lookAt
.
Here is some example code:
local Point0 = workspace:WaitForChild("Point0").Position
local Point1 = workspace:WaitForChild("Point1").Position
local Distance = (Point0 - Point1).Magnitude
local CF = CFrame.lookAt(Point0, Point1) * CFrame.Angles(0, math.pi / 2, 0) * CFrame.new(Distance / 2, 0, 0)
local Cylinder = Instance.new("Part")
Cylinder.Anchored = true
Cylinder.Shape = Enum.PartType.Cylinder
Cylinder.Size = Vector3.new(Distance, 1, 1)
Cylinder.CFrame = CF
Cylinder.Parent = workspace