- Home /
Duplicate Question
Adding a force(gravity) to a planet.
Hello guys! I am creating a space game in which you will be able to land on planets and explore them in their entirety. However, my trouble is finding a way to add a force(Gravity) to the player so they don't just fall of the edge of the planet! (Another problem would be trying to fix the problem of everything reversing when on the opposite side of the planet... But that can be resolved at a later date) My thought was adding an empty object in the center of each planet and "pull" the player towards it, however I feel this method is too risky and may lead to more flaws in the future. I am planning on having terrain on the planet so there will be imperfections. I know this might create a problem, so I mentioned it ahead of time. If anybody knows an alternative method to resolve my problem, help would be greatly appreciated! I am also pretty new to scripting in Unity3D! Thanks!
This is a question that has been asked and answered a number of times. Adding force in the direction of the center of the planet is generally the solution. You don't need an empty game object, just the position of the planet. If you are looking for a more realistic solution based on the mass of the planet and the player/ship, take a look at the wiki script:
could moderators simply delete duplicates so I don't have to. just click "close" and then "ok"
Follow this Question
Related Questions
Artificial Gravity 2 Answers
How do you create a continuous physics simulation in Unity? 1 Answer
Planetary based gravity 0 Answers
Player in Spaceship 2 Answers
I have a planetary gravity script; how do I make the object speed up? 1 Answer