Car ai that follows player car in a spherical world help

Hi all!

So I am creating a game in which a player plays as a red car on a spherical planet and is chased by a police car ai. A new police ai is spawned in every seven seconds. I have already set up the planet and have made it so the player can drive around and turn on the planet seamlessly but I am having some trouble with the ai.

I have made it so that a new police car is spawned in every seven seconds but I am struggling to have it chase the player and the gravity is being a little weird with it. I have tried to make the enemy simply face the player and drive forward but it did not work (I may have done it wrong though).

Can anyone give me some hints or suggestions?
Thanks

Find your vector between the police car and the player. That is only the general direction, because the line between police and player will probably go through the planet. Then rotate that vector so the up vector is the normal to the planet at the police car location. You could get the normal with some trigonometry, or using a ray trace toward the center of the planet.

It’s 2:30 am here, I don’t want to do math. Look in Vector3, Quaternion or Mathf classes to rotate the initial vector. I don’t really know how ray trace work in Unity, but that shouldn’t be too hard. If your planet is a perfect sphere, no mountains, then some simple trigonometry should be enough to get your normal.

Good luck.