I am currently using the method of making suspension-cars via constraints.
I’m having difficulty with fine tuning things such as: Suspension and Drift.
General info on the car
The cars use spring, Cylindrical and Hinge constraints.
The car’s wheels and body don’t collide for obvious reasons,
This is how the constraints are set up. Trying to mimic as closely as possible the default roblox suspension car.
Here’s also a quick video on how the car drives (The truck has better handling than the blue car):
Suspension
https://gyazo.com/95c3d6cec555b8dd36d6e263be584a6f
The suspension is too stiff, the wheels don’t push up into the car when driving up on a surface.
They’re also glitchy and often can cause the car to glitch into the ground.
These are the properties i am using, The possibility that the slider on the cylindrical constraint not working is ruled out also.
Drifting
At the moment, The drifting is just changing the Upper and Lower angle of the hinge constraints responsible for the steering. (You hold shift to steer)
These are the properties of the hingeconstraint.
The tires have custom physical properties enabled also to grip onto the road and allow smooth steering.
In efforts to make the car steer better, The torque on the front wheels are stronger to the ones on the back.
Tire’s Custom Physical Properties
Front wheel motor’s properties, The back motors have a torque of 7,500
In addition, I am handling the driving from a server-script:
elseif cart and cart:FindFirstChild("Chassis") then
local Speed = cart:FindFirstChild("Speed").Value
if Drift then
cart.RS.LowerAngle = -60
cart.RS.UpperAngle = 60
cart.LS.LowerAngle = -60
cart.LS.UpperAngle = 60
else
cart.RS.LowerAngle = -30
cart.RS.UpperAngle = 30
cart.LS.LowerAngle = -30
cart.LS.UpperAngle = 30
end
if not (cart.Chassis.Position.Y > (cart.Chassis.Position + cart.Chassis.CFrame.UpVector).Y) then
if Steer.Y > 0 then
cart.RS.TargetAngle = cart.RS.UpperAngle
cart.LS.TargetAngle = cart.LS.UpperAngle
elseif Steer.Y < 0 then
cart.RS.TargetAngle = cart.LS.LowerAngle
cart.LS.TargetAngle = cart.LS.LowerAngle
else
cart.RS.TargetAngle = 0
cart.LS.TargetAngle = 0
end
if Throttle == Vector3.new(-1,0,0) then
cart.BLM.AngularVelocity = Speed
cart.BRM.AngularVelocity = Speed
cart.FLM.AngularVelocity = Speed
cart.FRM.AngularVelocity = Speed
elseif Throttle == Vector3.new(0,0,0) then
cart.BLM.AngularVelocity = 0
cart.BRM.AngularVelocity = 0
cart.FLM.AngularVelocity = 0
cart.FRM.AngularVelocity = 0
elseif Throttle == Vector3.new(1,0,0) then
cart.BLM.AngularVelocity = -Speed / 3
cart.BRM.AngularVelocity = -Speed / 3
cart.FLM.AngularVelocity = -Speed / 3
cart.FRM.AngularVelocity = -Speed / 3
end
else
FlipCar(cart)
end
else
If you want to test the cars out yourself here is the game link: