I have this chassis which works fine, but when it comes to braking in movement it’s not great and relies mostly on just stopping by itself when there’s no throttle.
How would I make it have a greater effect when braking?
Code:
local Steer, Wheels, Seat = script.Parent.Parent.Steering:GetChildren(), script.Parent.Parent.Wheels:GetChildren(), script.Parent
local Speed = 100
local sSpeed = 45
Seat.changed:connect(function()
for _,v in pairs(Wheels) do
v.HingeConstraint.AngularVelocity = - Seat.Throttle * Speed
end
for _,v in pairs(Steer) do
v.HingeConstraint.TargetAngle = Seat.Steer * sSpeed
end
end)
The easiest way, that I know of is to add a BodyVelocity when the brakes are applied and set the Velocity to Vector3.new(0,0,0).
For a advance option, This article is pretty old but explains a lot about how car physics can be implemented in game, and it also has a section where it explains how to calculate the braking force that needs to be applied in opposite direction.
Ok, I didn’t get this to really work, I’ve only just started learning about how cars work therefore im not too experienced. Where would I exactly put the BodyVelocity and is there a way to apply more force to the opposite direction to force it to stop?
I’m not an experienced scripter, but as far as I know (with my knowledge from car a bit), you should try locking up the wheel, as far as I read your script you’re only stopping the wheel from rotating, but the wheel still rotate freely, if locking up the wheel doesn’t work, I’d suggest putting BodyVelocity in the wheel and use “lookvector” to get the direction the wheel is facing and apply velocity.
I’m not experienced, I’m just doing my best to help, sorry if I did anything wrong here.