How do I get my Car to behave as if it were on the Ground, even on a Slope/Land

Hey, for the last couple of weeks I’ve been working on a constraint based car chassis based on @Sleitnick’s car rigging tutorials, it’s far from finished but I want to add a feature that I saw in Driving Simulator but don’t know how to recreate it :

Currently my chassis can climb hills but it needs high speed and it is very slow, what I want to do is when the car is on a hill it behaves as if it is on the ground as you can see in the video below.

Here is the function to make the car moves.

local function throttle(throttle)
	local torque = seat.Torque
	local speed = seat.MaxSpeed * throttle

	cylRL.MotorMaxTorque = torque
	cylRR.MotorMaxTorque = torque
	cylFL.MotorMaxTorque = torque
	cylFR.MotorMaxTorque = torque
	cylRL.AngularVelocity = speed
	cylRR.AngularVelocity = -speed	
	cylFL.AngularVelocity = speed
	cylFR.AngularVelocity = -speed
end

Any help is appreciated, thank you!

The key here is torque. Because the cylindrical motors are similar to electric motors, giving it a lot of torque but no speed is essentially like locking the motors in place. So in order to get the car to stop on an incline, the torque needs to be pretty high, even if the throttle is 0. Similarly, to get up steep slopes, you’ll need a lot of torque as well.

So the solution is to increase the torque. You may also need to change the friction of both the wheels and the ground (if you see it slipping).

The down-side is that you lose out on the physics engine giving some realism to the car, so you might see the car accelerate/decelerate pretty fast.

2 Likes

Thank you for the very quick reply, I will try tomorrow to change the torque only if the car is on a slope.