Hinge constraint doesn't breaks immediatly and goes back and forward

Hello, I am making a parking brake system, but the car, exchange of breaking immediately (locking the wheels) it just stops smoothly and goes back and forward, and so on.
Example;

Here is the code;

	elseif (Variables.ParkingBrake == true) then
		RearLeft.Motor.AngularVelocity = 0
		RearLeft.Motor.MotorMaxTorque = math.huge
		RearRight.Motor.AngularVelocity = 0
		RearRight.Motor.MotorMaxTorque = math.huge

		FrontLeft.Motor.AngularVelocity = 0
		FrontLeft.Motor.MotorMaxTorque = math.huge
		FrontRight.Motor.AngularVelocity = 0
		FrontRight.Motor.MotorMaxTorque = math.huge
	end

I think its because even though the wheels stop spinning it doesn’t stop the car from sliding so try enabling custom physical properties and making the friction higher to an amount that stops it from sliding but don’t make it too much or the car will instantly stop and you wouldn’t want that since cars irl don’t stop instantly

2 Likes

Seems like it’s not that

Oh I see the issue is the wheels doesn’t stop spinning so for that you can weld the tires to the body when you break, so they have no way to move

Edit: an easy way to do that will be Weld them in studio and set enabled to false then when you break, set enabled to true

1 Like

Uh well, Setting force to math.huge and angular velocity to 0 would have to work, also max acceleration is set to math.huge

But it doesn’t work so try welding

Edit: but yes it should work but this is scripting expect a lot of stuff like this

I don’t try to find other solution, I try to find the problem, it should work and it doesn’t what else could it be?

It’s physics it happens instead of trying so hard to fix just use welds it will make your work easier theres no reason to not use it

1 Like

Ok but do you know what might be causing it?

1 Like

I don’t know what’s causing it

You can not really know because if something should work in theory and you made no mistakes and considered everything and it still doesn’t work then there isnt much you can do but you can fix it by using another way just like we did

I use a simple setup to ‘stop’ wheels. When you have a HingeConstraint system driving the wheels the issue seems to be that the wheel’s Velocity and RotVelocity seems to override the HingeConstraint’s AngularVelocity.
When I have a vehicle that I need to stop the wheels from spinning when there is no input I set a variable at the beginning like
local stop = Vector3.new(0,0,0)
and when the VehicleSeat.Throttle = 0 then I make each wheel’s Velocity and RotVelocity = stop