SpaceJim has a pretty good handle on space! (Surprise, surprise)
Just to embelish, you don't need to do a trace at all to determine gravity.
just use a vec_dist command on the player.pos and planet.pos to get the distance.
From the distance away, derive the force of gravity.
Take the force, and convert it to a vector.
Use the vec_rotate command to point your gravity vector at the planet.
apply this rotated force to your entity being influenced by gravity.
I'll leave the details to you, but I hope this gets you started!
- WildCat