How to calculate the perfect amount of Force to move a Part

When I search around in the web I mostly see people using random huge numbers when working with BodyVelocity or VectorForce. But if I do the same, I have the feeling I don’t get a good result to move my MotorCycle. (I am using VectorForce)
First I thought I just need to calculate with F = m*a but that didn’t bring the right result.
Then I thought, maybe I need to overcome the static friction but then question appeared:
Am I on the right way, is there a better way to do this?
Does Roblox use friction coefficients?
Do I need to calculate the friction with the Physical Properties of the Cycle and the Baseplate like shown here?

I am lost in questions and thoughts

3 Likes

The perfect amount of force would depend on the surface its touching, how fast you want it to accelerate, and multiple other properties of the object itself like mass and friction
If you knew everything, you could probably calculate it doing something like:
A = whatever acceleration you want in studs per second per second
K = calculate friction like in the article, accounting for the friction of both the surface its touching and the surface of the object itself ((F1 * W1 + F2 * W2)/(W1 + W2))
F = (M * A)/K

Im assuming thats how roblox friction works but I really dont know (I also cant imagine it works too differently from this), let me know how it works

3 Likes

Yes, with some testing i found out a pretty nice solution,like what you said.
The thing is, the friction you get from the formula is really the friction coefficient, so we need to convert it to Friction-Force(i guess it is called like this) because we need to overcome it which is done with:

Ff = µ * m * g

Ff = Friction Force; µ = Friction Coefficient; m = mass; g = gravity
now we know that the Force required is > Ff to move the part
to move it with a specific acceleration we need to add the Friction Force to the formula of the Force for the acceleration:

F = m*a + Ff

----This Part i irrelevant for the issue but to explain the rest of the comments I keep it in here----

But idk what i am doing wrong.
When I check the acceleration by calculating it right when I stop accelerating I get around the Half of my acceleration:
My Formula for the acceleration:

local Friction = (FrictionA * FrictionWeightA + FrictionB * FrictionWeightB)/(FrictionWeightA + FrictionWeightB)
local Force = Friction * (part:GetMass()*workspace.Gravity) + part:GetMass() * 10
script.Parent.Force = Vector3.new(0,0,Force)
wait(5)
script.Parent.Attachment0 = workspace.Part.Attachment
wait(10)
script.Parent.Attachment0 = nil

And the other formula:

wait(5)
pos1 = script.Parent.Position
wait(10)
pos2 = script.Parent.Position
d = (pos1-pos2).magnitude
t = 10
print(d/(t*t)) 

These two are in two different scripts
and the output is around 5, I have tested it with 10 sec and 16 sec

2 Likes

Have you tried getting the acceleration in the main script?
It might just be as simple as a timing issue
Also yes my bad, you did the friction correctly
Forgot physics class for a second

2 Likes

Now I have tried in the same script, still around 5
So the timing isn’t the problem I guess

Try calculating a series of very quick acceleration values very quickly, like runservice quick using assemblylinearvelocity, saving the previous velocity and calculate acceleration from that

Like:

--set force 
local lastVelocity = Vector3.new()
for i = 1,50 do
    local dt = runService.Heartbeat:Wait()
    local v = p.AssemblyLinearVelocity
    print((v-lastVelocity)/dt)
    lastVelocity = v
end
--turn off force

The acceleration should be constant and depending on what it looks like different problems could be diagnosed, like roblox actually has static and kinetic friction or something

1 Like

Hmh, the results look pretty promissing

Output
  15:18:19.312  0.0014094926882535, -0.055807035416365, 9.8101205825806  -  Server - Script:26
  15:18:19.329  -0.00017514075443614, 0.00017490045865998, 7.8040518760681  -  Server - Script:26
  15:18:19.345  -0.00023591675562784, 0.000239639179199, 12.317575454712  -  Server - Script:26
  15:18:19.364  -0.00013850066170562, 0.00014303738134913, 8.6947727203369  -  Server - Script:26
  15:18:19.380  -0.00014157617988531, 0.00015508671640418, 10.325038909912  -  Server - Script:26
  15:18:19.395  -0.00011991945939371, 0.00012923893518746, 10.325057029724  -  Server - Script:26
  15:18:19.412  -0.00064047978958115, 0.00060470792232081, 9.7175798416138  -  Server - Script:26
  15:18:19.429  -0.00014955142978579, 1.1077622730227e-05, 10.325090408325  -  Server - Script:26
  15:18:19.446  -2.0488725567702e-05, 1.5002154214017e-05, 10.487293243408  -  Server - Script:26
  15:18:19.463  1.3394096640695e-05, 1.9907633031835e-05, 9.2776403427124  -  Server - Script:26
  15:18:19.479  2.4391178158112e-05, 1.5926105334074e-05, 11.13316822052  -  Server - Script:26
  15:18:19.495  2.1983738406561e-05, 1.0539334653004e-05, 9.8233423233032  -  Server - Script:26
  15:18:19.513  1.9355658878339e-05, 1.7565558664501e-05, 9.8233766555786  -  Server - Script:26
  15:18:19.530  1.6849979147082e-05, 2.0978390239179e-05, 9.7766437530518  -  Server - Script:26
  15:18:19.545  1.5439796698047e-05, 1.4918600754754e-05, 10.428833007813  -  Server - Script:26
  15:18:19.563  1.2242609045643e-05, 1.7551295968588e-05, 9.815372467041  -  Server - Script:26
  15:18:19.580  1.0522843695071e-05, 2.1061554434709e-05, 9.8153867721558  -  Server - Script:26
  15:18:19.596  9.1629972303053e-06, 1.7551295968588e-05, 9.8154010772705  -  Server - Script:26
  15:18:19.613  8.2747810665751e-06, 1.8648252080311e-05, 10.428862571716  -  Server - Script:26
  15:18:19.629  6.8164422373229e-06, 1.8047983758152e-05, 10.093169212341  -  Server - Script:26
  15:18:19.646  5.7473121160001e-06, 1.7633794413996e-05, 9.8614950180054  -  Server - Script:26
  15:18:19.662  5.1407819228189e-06, 1.8735907360679e-05, 10.477853775024  -  Server - Script:26
  15:18:19.679  4.1232979128836e-06, 2.1160552932997e-05, 9.8615226745605  -  Server - Script:26
  15:18:19.695  2.9796542548866e-06, 1.5987974620657e-05, 8.3822708129883  -  Server - Script:26
  15:18:19.712  2.9812767934345e-06, 1.9984967366327e-05, 9.3136215209961  -  Server - Script:26
  15:18:19.730  3.1781589768798e-06, 1.9870549294865e-05, 11.575416564941  -  Server - Script:26
  15:18:19.746  2.3804232114344e-06, 1.7441303498344e-05, 9.7538471221924  -  Server - Script:26
  15:18:19.762  2.1010046111769e-06, 2.2237662051339e-05, 10.36346244812  -  Server - Script:26
  15:18:19.780  1.8033367723547e-06, 1.7441303498344e-05, 9.7538747787476  -  Server - Script:26
  15:18:19.795  1.688047063908e-06, 1.8531385649112e-05, 10.363492012024  -  Server - Script:26
  15:18:19.812  1.3522709423341e-06, 2.0929564925609e-05, 9.7539024353027  -  Server - Script:26
  15:18:19.829  1.2588234312716e-06, 2.2163201720105e-05, 10.328790664673  -  Server - Script:26
  15:18:19.845  1.1816919140983e-06, 1.4966730304877e-05, 10.462463378906  -  Server - Script:26
  15:18:19.862  1.0095960760736e-06, 2.1129500964889e-05, 9.8470802307129  -  Server - Script:26
  15:18:19.880  7.1151572456074e-07, 2.1129500964889e-05, 9.8470239639282  -  Server - Script:26
  15:18:19.895  6.4325513449148e-07, 1.8708413335844e-05, 10.462463378906  -  Server - Script:26
  15:18:19.912  3.8519499412359e-07, 1.4966730304877e-05, 7.8468475341797  -  Server - Script:26
  15:18:19.930  5.3791217169419e-07, 2.1802237824886e-05, 10.886293411255  -  Server - Script:26
  15:18:19.945  4.5506988044508e-07, 1.5771882317495e-05, 11.025428771973  -  Server - Script:26
  15:18:19.962  3.1102541697692e-07, 1.9714852896868e-05, 9.1878051757813  -  Server - Script:26
  15:18:19.980  2.8084619430047e-07, 2.0874549591099e-05, 9.7282361984253  -  Server - Script:26
  15:18:19.995  2.7651108780447e-07, 1.9714852896868e-05, 11.025334358215  -  Server - Script:26
  15:18:20.013  2.4184353719647e-07, 1.6429044990218e-05, 9.1877527236938  -  Server - Script:26
  15:18:20.028  2.0260372934899e-07, 1.8482674931874e-05, 10.336250305176  -  Server - Script:26
  15:18:20.045  1.9040733434394e-07, 2.2846887077321e-05, 10.647379875183  -  Server - Script:26
  15:18:20.064  8.5652011705406e-08, 1.5763795090606e-05, 8.8157453536987  -  Server - Script:26
  15:18:20.080  1.4138451831514e-07, 2.2463407731266e-05, 10.468636512756  -  Server - Script:26
  15:18:20.095  1.1126703469699e-07, 1.5973977497197e-05, 8.3748693466187  -  Server - Script:26
  15:18:20.113  8.78388348724e-08, 2.1142030163901e-05, 12.316219329834  -  Server - Script:26
  15:18:20.129  9.5003308331343e-08, 2.2463407731266e-05, 10.468786239624  -  Server - Script:26

Even if i don’t know why there are accelerations for x and y when I only move it on z axis but ok

1 Like

So i just used this to check

wait(5)
script.Parent.Attachment0 = workspace.Part.Attachment
wait(10)
local v = part.AssemblyLinearVelocity.Z
print((v-lastVelocity)/10)

script.Parent.Attachment0 = nil

and the results are around 10
so the problem was my formula

@PapaBreadd Thanks for the help ^^

1 Like