How to calculate the amount of force to move a model

I want to calculate the perfect amount of force to move a model and I tried the formula f = ma but I think there is air friction because when I make the force to 0, the vehicle stops instantly. Is there any way to calculate the perfect amount of force to move a model?

Why not use the LinearVelocity constraint? Parts generate friction when they touch just like tires on a road in real life.

I tried it but the gravity didn’t affect the vehicle when I used LinearVelocity. For example when it goes up on a ramp, it flies after the ramp finishes.

It’s f=ma, not v. Are you trying to set the velocity rather than the force?

There is no air resistance or drag in roblox.

1 Like

You can use the F = ma formula as others mentioned it.

image

local Part = script.Parent

-- Mass
local m = Part.AssemblyMass

-- Acceleration
local a = 100

-- Calculate the force
local F = m * a

In Roblox you can use VectorForce instance to apply force to an object.

-- Apply the force in the direction that the part is facing
Part.VectorForce.Force = Part.CFrame.LookVector * F

However, if you want to apply an instant force impulse then use ApplyImpulse method.

Part:ApplyImpulse(Part.CFrame.LookVector * F)
6 Likes

Ah sorry, my bad and yes its f = ma I am trying to find the force

When I use the formula I want the part to accelerate 10 studs per second but it doesn’t even move and I think that is because of the air friction. Is there any way to disable or calculate it?

There is no air friction in Roblox, but if you need to account for gravity then that is 196.2.

1 Like

I am trying to make a force that is horizontal, not vertical so I think that there is no need for the gravity but if it’s needed, can you explain to me?

I think you need to provide more details about your set up. How are you applying this force? With a VectorForce or something else?

How is your vehicle constructed?

Do you have code that you tried that wasn’t quite doing what you wanted? Can you share that code?

1 Like

I tried with VectorForce and for trying the code, the vehicle is just a part. The code i tried was:

vf = script.Parent.Parent.VectorForce
seat = script.Parent

while wait(0.1) do
	if seat.Throttle == 1 then
		 vf.Force = Vector3.new(script.Parent.Parent.AssemblyMass * 10, 0, 0)
	end
end

I was going to do this code with lookVector but since this code didn’t work I didn’t do that.

I don’t know the exact setup of your car, but there’s multiple reasons of why it may not be working

  1. Is your vehicle in a frictionless environment? If the answer is no, you have to take gravity into account.
  2. It seems like you’re only taking into account the weight of a single part, ideally you want to calculate the weight of the whole vehicle + the player.

Ok thanks, when I did it without the gravity it seems to work but how do I take gravity into account?

If the car needs to be suspended in the air then all you need to do is apply a force in the upwards direction equal to that of the (car’s mass + the player’s mass) * gravity. Gravity in Roblox defaults to 196.2, this can be checked by indexing the workspace’s ‘Gravity’ property.

https://developer.roblox.com/en-us/api-reference/property/Workspace/Gravity

Chances are, you want the vehicle to not be suspended in the air (such that it falls), so you may want to multiply the ‘gravity’ in the above equation by some fraction.

Is it fair to say that you want your car to slide along the ground, not fly through the air?

Yes, you are correct. I am trying to do that

Have you tried just setting the friction on your vehicle to 0?

Offsetting gravity doesn’t seem to be the right move @Forummer, better would be to offset the friction by increasing the push force, not adding a vertical force

I’m not entirely sure what the thread’s poster is trying to achieve but if they want to disregard friction they can set the ‘Friction’ property of all of the vehicle’s contact parts to 0.

https://developer.roblox.com/en-us/api-reference/datatype/PhysicalProperties

Second argument to the PhysicalProperties.new() constructor function.

1 Like

I fixed the problem, thanks for the help @Forummer and @nicemike40.

1 Like