How to calculate/find/get a normal vector from an object to a round planet to use in angle calculations/ 3D movement/etc..

I am just starting to build a game where the player controls a tank on a round world/planet. I have implemented a gravity script that pulls objects to the planet. the tank falls and drives around and I even put a “moon” in orbit. problems occur with moving the tank with respect to a third person camera. the tank will move away from the camera when pressing w, toward with s, left of with a and right of with d. this is sort of what I want, but examples of the issue are, if you angle the camera up (to shoot up into the air) and press forward, your tank will fly. as impressive as a flying tank is, it is not what i want to happen. the same thing will happen while looking down and moving backward. if you manage to roll the tank on its side, flying can be achieved by pressing the left or right key that faces away from the surface.

I want to use this “normal” vector to calculate if I need to automatically roll the tank in the upright position ( which itself is not calculable without the vector). i would like to use it to check if the tank’s z and/or x angle is greater than 90 and less than 270 (fallen too far right or fallen too far left. If the angle of the tank is in between these angles it is sideways or upside down). It is difficult or impossible to decide the upright direction of the tank in worldspace because, starting on the “upright” side of the planet and going to the opposite side of the world, the tank would be upside down, or going to the equator would yield angles 90 degrees to upright.

I want to maybe use it to get the forward direction relative to the camera, regardless of its height to the tank. if I look down (or up) I want to move forward tangent to the surface I am on but still forward with respect to the angle the camera is facing.

I would like to keep the camera somewhat unbound to the tank. if I’m going up a hill, I want the camera to consider the normal angle rather than the tank. I want 0 degrees elevation of the camera to be tangent to the world. (effectively if the tank goes up a hill, and the camera is at 0 degrees, I should be able to see its roof).

How would I go about implementing this.I am very lost.

Thanks for your answers.

never mind, figured it out.
give me a while and I’ll let anyone who wants to know in on the secret.