You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? A simulated rope like Roblox’s rope constraint.
-
What is the issue? Include screenshots / videos if possible! Idk what to do.
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub? I didnt find a topic that helped me. I’ve implemented something but it’s not what i want.
The system I have right now is based on two force vectors pushing but I can’t think of how to stop the force right when the player is inside of the distance of the simulated rope.
1 Like
-
Create two attachments that represent the ends of the rope. These attachments should be parented to the parts you want to connect.
-
Create a part or a mesh part to represent the visual appearance of the rope.
Class RopeConstraint
RopeConstraint
I’m not trying to use robloxs rope constraint.
-
Create two parts that will act as the attachments for the rope.
-
Use a BodyVelocity or BodyForce object to apply a force to each attachment, pulling them towards each other.
-
To stop the force when the player is inside the distance of the simulated rope, you can use a constraint to limit the maximum distance between the attachments.
-
You can use a RodConstraint or a SpringConstraint to create the constraint between the attachments. Adjust the properties of the constraint to control the stiffness and length of the simulated rope.
-
You can also add additional constraints or forces to allow the attachments to rotate or move in certain ways, depending on your desired effect.
Example code:
-- Attachments
local attachment1 = game.Workspace.Part1.Attachment1
local attachment2 = game.Workspace.Part2.Attachment2
-- Create constraints
local rodConstraint = Instance.new("RodConstraint")
rodConstraint.Attachment0 = attachment1
rodConstraint.Attachment1 = attachment2
rodConstraint.Length = 10 -- Adjust the length as needed
rodConstraint.Visible = true -- Set to false if you don't want the constraint to be visible
-- Apply forces to attachments
local bodyForce1 = Instance.new("BodyForce")
bodyForce1.Force = Vector3.new(0, 0, 100) -- Adjust the force as needed
bodyForce1.Parent = attachment1.Parent
local bodyForce2 = Instance.new("BodyForce")
bodyForce2.Force = Vector3.new(0, 0, -100) -- Adjust the force as needed
bodyForce2.Parent = attachment2.Parent
I’m sorry I should’ve been more through from the start. I’m trying to connect two players with a simulated rope and the problem is that using any constraint is gonna be problematic, because of networkownership. Any idea how to go at it without constraints?