Locomotion and Jcar

Hi everyone, im having a few problems with a mixture of jcar and locomation.

basically i have a spherical planet that i want to drive my car (based off jcar script),in order to have the car always stick to the terrain i tried copying the locomotion planetwalker setup. So i have a physics character moto and its required scripts that i have attached to my car.

This also has the jcar script for driving. My problem is the car always seems to use gravity and thus fall off when i get to the edges/bottum of the planet.

I have tried numerous other supposed planetwalking scripts, faux gravity e.t.c and i cant seem to get any of them working.

Anyone have a working example of a planetwalk script ? I dont believe jcar as effect on locomotion as i take off the script and it still doesnt work.

THanks in advance.

To create gravity, you can start by getting a vector from the car’s position to the planet’s centre:-

var gravDir = planet.transform.position - car.transform.position;

You then just need to normalise that vector, multiply it by the desired gravity strength and use it to add a force to the car:-

gravDir.Normalize();
car.rigidbody.AddForce(gravDir * gravStrength);