Make Friction Not Gain Speed

Hello developers,
I am currently using the Friction property for my game. Basically, I want the object to slide down the hill (the hill is slanted) but not have the object go faster over time. I know this doesn’t make sense, but I’m still looking for a way to do this.
Thanks!

1 Like

Using Roblox physics would be very problematic, as you can’t really prevent acceleration (even if you could the slide would just stay fixed, as it can’t accelerate to it’s terminal velocity).
The best way I can think of is using BodyVelocity.
You can also simulate Drag Force behavior which would lead to more realistic results.

1 Like

What’s the script and where’s the issue?

Yeah I agree, the problem with BodyVelocity is I’m not sure if it can replicate the same effects as the physics system. For example, I’m not sure if there’s a simple way using BodyVelocity to make the object topple over

1 Like

Again, it isn’t so flexible. The other solution is pretty complicated and is to simulate Drag behavior on the slide. You can also increase the friction so it doesn’t accelerate too fast. Ask yourself, is this feature really essential, as it is quite hard to implement on Roblox Studio, and make the decision accordingly.

2 Likes

Yeah I think drag force is the best bet to have it slide down at a constant speed as @ComplexMetatable mentioned.

Shouldnt be too hard though just a vector force with the loop set to this equation

local netDragForce = -unitXZ*(xzSpeed^2)*model:GetAttribute("XZDragFactorVSquared")
VectorForce.Force = netDragForce

I use this in my PhysicsCharacterController so it should work.

unitXZ is the (velocity*Vector3.new(1,0,1)).Unit

xzSpeed is the above but just replace with .Magnitude

The attribute is just a flat number coefficient based on how much drag you want.

Maybe you might want to include the Y axis and not multiply by zero but it will effect falling down acceleration as well which you might not want. Try it out I guess.

2 Likes

I’m just curious, what value did you put for the attribute? It doesn’t seem to be slowing down for me:

local DragAmount = 100

while task.wait() do

local netDragForce = -(10 * Vector3.new(1, 0, 1).Unit)*((10 * Vector3.new(1, 0, 1).Magnitude)^2)*DragAmount

script.Parent.VectorForce.Force = netDragForce

end

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.