How exactly would i go about making a car like jailbreak's?

The title says it all, I want to make a car like jailbreak’s, with suspension, drifting, acceleration, the whole lot.

I know already that there’s a way to do it purely by script and bodythrust, but i’m not sure where i would start and if this is even the way to do it.

Would i have to constantly update the cars’ suspension with a loop (this could be intensive if there’s 20 people each with their own car) or is there a workaround?

Any articles / information containing formulas / methods on making cars is helpful also. Thank you

4 Likes

EDIT: I’ve found a formula for the suspension, I am applying this force to individual BodyForces within the wheels and chassis:

local CarWheels = {
	script.Parent.BL.Rim,
	script.Parent.FL.Rim,
	script.Parent.BR.Rim,
	script.Parent.FR.Rim
}

local d = 3.5

local a = 1.8 --Stiffness, higher means higher height at suspension
local b = 0.6 --Rigidity higher means the suspensions will get less effected by slight changes and will balance out unlike Roblox's suspensions. This is the part that dampens the suspension.

local ST = {dx=0,d2x=0} --For storing the derivatives per suspension

local Car = script.Parent.Chassis

while wait() do --For every suspension, in this case 4 of them
	for _, Wheel in pairs(CarWheels) do
		local x = d - 3 --X is how much the suspension is contracted
	
		local f = a*x + b*(x-ST.dx) + b/2*(x-ST.d2x) --Use the equation
	
		ST.d2x = ST.dx --Store the past values
		ST.dx = x
	 
		Car.Suspension.Force = Vector3.new(0,f,0) --Apply the forces
		Wheel.Suspension.Force = Vector3.new(0,-f,0)
	end
end

No matter the value of the force, it doesn’t work


image

2 Likes