How to bend a fake rope made from parts?

I’m creating a fake rope out of parts that connects between two points, I’m using parts because I need it to be able to detect it touching things, and i’m not using a rope plugin because I need it to be created in game.

This is the code I have so far, and it creates a line of parts to the two positions, but i’m unsure on how to do the math for making it bend as if it had gravity, i’m terrible at math so if anyone could help i’d appreciate it.

local startPosition = Vector3.new(236.25, 7.25, -87.375)
local endPosition = Vector3.new(235.875, 12.75, -107.125)
local ropeSegments = {}
local numSegments = 10
local segmentLength = (startPosition - endPosition).magnitude / numSegments

local function createRopeSegment(startPos, endPos)
	local ropePart = Instance.new("Part")
	ropePart.Anchored = true
	ropePart.Size = Vector3.new(0.2, 0.2, segmentLength)
	ropePart.CFrame = CFrame.new(startPos, endPos)
	ropePart.Parent = game.Workspace.AA
	ropePart.Material = Enum.Material.Marble
	ropePart.BrickColor = BrickColor.new("Maroon")
	return ropePart
end

for i = 1, numSegments do
	local segmentStartPosition = startPosition + ((endPosition - startPosition).unit * segmentLength * (i - 0.5))
	local segmentEndPosition = startPosition + ((endPosition - startPosition).unit * segmentLength * i)
	local ropeSegment = createRopeSegment(segmentStartPosition, segmentEndPosition)
	table.insert(ropeSegments, ropeSegment)
end
1 Like

can’t you just put a bodymover on the middle piece?

I’m not trying to simulate gravity, i’m just trying to make the rope bend as if it were too long.