Replicate physics.gravity with custom code.

I’m working on a kart game, and I want to be able to play with the gravity. I have a simple box with cylinders fitted with wheel colliders. I have turned off the ‘useGravity’ and tried various methods to apply custom gravity, such as rigidbody.AddForce, as well as a ConstantForce component. First I set them all to the same value as the default physics.gravity, then I tried other numbers. When using this custom gravity the kart does not respond well at all: bumping, sliding, turning in odd directions.

Here is one example the relevant code:

function Update(){

function ApplyGravity(){	

Add constantForce to your gameobject, and play with it =)?

gravity is per second. It should be applied during fixedupdate.

Your applying 9.8 meters of force every whatever. Whatever is an unknown. update runs as many times as it possibly can during the game. Slow comps run less often for example.

FixedUpdate runs BY DEFAULT 50 times per second.

if you want 9.8 meters per second then in fixed update
run it but applyGravity should be

(-vector3.up * 9.8 ) / 50