How do I limit the velocity of VectorForce?

Do I have to make it relative to world? I made mine relative to attachment0.

Yep for the drag force as drag force is relative to Assembly Linear Velocity direction which is in world space.

For the movement it’s up to you, mine is because Humanoid move direction is relative to world.

1 Like

Can you also explain to me what is this line for?

local XZVector = Vector3.new(1,0,1)

Oh that’s being multiplied in order to make the drag force only happen for the XZ plane when you are moving left and right.

Since it’s being multiplied it makes the Y zero and hence makes the drag force not happen at all when you are falling down and up. Unless you want a some sort of parachute effect.

i am sorry i didnt notice that. i am in elementry :smiling_face_with_tear: so i dunno what drag is tho i understood what it is now.
But he just wants a force limiter on a vector force so he should be good with a while loop but @dthecoolest 's method is better as it allows more customization

1 Like

Sorry, but what is “Unit”? Is this meant to be a defined variable already?

Unit is a vector with the length of one, hence one unit.

it describes the direction of the drag force.

-velocity.Unit

The rest is a factor on how much to increase this drag force in this direction.

--drag factor, depends on speed
(speed^2)*XZVector

Oh because the error I’m getting is saying ‘Unit is not a valid member of VectorForce’.

Try mine once. It should work but i still strongly reccomend you to solve the error.
(also you do VectorForce.Force.Unit)

I don’t understand the code, what do you mean by
Vector3.new(YourDesiredClampValue`sX,YourDesiredClampValue`sY,YourDesiredClampValue`sZ?

I need explanation for things.

For some reason, doing this causes my car to spin and turn oddly.

You might want to apply drag to the center of mass then.

https://developer.roblox.com/en-us/api-reference/class/VectorForce

Also checking out the direction of the force is good like the relative to options.

Oh, would I also do the same for the vectorForce?

u could do a loop with

while wait() do
if forcevalue >= vector3.new(number,number,number) than
forcevalue == vector3.new(number,number,number) 
end
end

i don’t know to will it work but i think it should

Yes, but what am I replacing ‘numbers’ with?

you replace the number with limit you want for each side and basicly if the force value goes over any of these numbers it will put them to the force value limit

Well I hope you understand cframe/positions.
Your desired clamp’s x is the X value of Vector three and soo on for the others.
So if the force is gonna reach that power it’s gonna be limited to your desired speed.

Also you should do this i was a Dumbo before to not convert it in a variable

local LimitForce = Vector3.new(X,Y,Z)

if VectorForce.Force >= LimitForce then
VectorForce.Force = LimitForce
end
end

It says attempt to compare Vector3 <= Vector3.

Ok so yeah you can’t compare them directly.so do this.

local VectorForLimits = Vector3.new(x,y,z)

if VectorForce.Force.X > VectorForLimits.X or VectorForce.Force.Y > VectorForLimits.Y or VectorForce.Force.Z > VectorForLimits.Z then
VectorForce.Force = VectorForLimits
end

Hold up i think i already put a script here