Making a part follow a set of nodes using VectorForce

I have a part with 4 attachments on each of its’ corners, and inside every attachment there is a VectorForce.
brick
My goal is to make the part follow a set of nodes accurately regardless of how fast it is moving.


How would I go about this? I tried using directional forces towards the nodes ((node.Position - part.Position).Unit)
but they create backwards force once each node is passed and the part does not turn when the node path is curved. I want the part to behave almost like it’s “on a rail”.

2 Likes

why do you need four vector forces?

2 Likes

Because the part is player controlled to an extent and I need it to be physics based

2 Likes

oh but you said your goal is to make the part follow a set of nodes accurately, so how would the player control it if it is forced to follow the nodes?

2 Likes

The player will only control the rotation of the part and the speed it moves with, the actual following mechanic is supposed to be automated

2 Likes

does the part’s rotation affect the movement direction?

1 Like

No, it’s still going to move in the same path

1 Like

oh so you already know how to rotate and control the speed of the part right? and you only don’t know how to let that part follow the nodes?

Yes, that is what I’m asking for help with

are you a hurry or something? cuz this might take a hour for me to type

Nope, as long as I get a solution I don’t mind waiting

Follow Nodes.rbxl (48.1 KB)
all the things are in Workspace, it can act weird at high speed

also I used LinearVelocity instead of four VectorForces

That defeats the purpose, it is easily done with LinearVelocity. I need to get it done with VectorForces.

so you wanna let the part follow the nodes only by using four vector forces?

Yes, and I want that part to be stable/stay on track while following the nodes regardless of how fast it is going.

Follow Nodes (Vector Force).rbxl (47.8 KB)

I only used one vector force and is it alright if I mess with the part’s velocity?
Also this thing cannot go up and down, but I can try if you want it to go up and down (Y axis)

And also sorry for the late reply, I went to sleep

I can’t have anything messing with the part’s velocity sadly

then counteracting the part movement using vectorforces will be pretty hard but possible since you have to be turning direction to follow nodes by using acceleration and deceleration, and will most likely be difficult to stay perfectly on track

You can slow down the part depending on how fast it’s going in order to make the part more accurately follow the curve, here’s the code for the force (higher strength value makes the part accelerate faster, and higher damping value makes the part decelerate faster):

((Node.Position - Part.Position).Unit * Strength - Part.AssemblyLinearVelocity * Damping + Vector3.yAxis * workspace.Gravity) * Part.AssemblyMass

I already have the acceleration set up, I’m just looking for a method to keep the part in place without messing with the velocity.