Unity Tutorial: Faux Gravity (walk on planets)
Why Game Development Stack Exchange recommends it
Game Development Stack Exchange users link it when someone asks how to attract objects to a sphere or keep a character glued to a spherical world in Unity.
Recommended by 4 people across 4 different months, 2014 to 2018.
What it is
A 2014 Unity tutorial by Sebastian Lague that builds a faux gravity system so characters can walk around a planet without falling off, in the style of Super Mario Galaxy. It walks through the setup in the Unity editor and includes a planet model and project download.
What people said
Recommends Daniel Kvist · 2014-12 · Game Development Stack Exchange · on “How could I constrain player movement to the surface of a 3D object using Unity?”
Rotation Checkout the answer on this question on answers.unity3d.com [LINK] (actually asked by myself). Quote: The first task is to get a vector that defines up. From your drawing, you can do it in one of two ways. You can treat the planet as a sphere and use (object.position - planet.position). The second way is to use Collider.Raycast() and use the 'hit.normal' it returns. Here is the code that he suggested me: var up : Vector3 = transform.position - planet.position; transform.rotation = Quaternion.FromToRotation(transform.up, up) * transform.rotation; Call that every update, and you should get it working. (note that the code is in UnityScript ). The same code in C# : Vector3 up = transfor
Recommends zimspy · 2016-06 · Game Development Stack Exchange · on “How to add constant force to player with sperical gravity planet.?”
There is the Faux gravity system in Unity and it works with jumping as well. TThis is the youtube link - [this video] . The download link for the unity project seems to be dead though. Ive uploaded the project to my mediafire account. I'l also add it to github when i get on a PC. link - [LINK] Edit 1: Adding constand force- In order to add a constant force to the player object, in the Player Controller script, edit the update method. Replace all the code in update with this moveDirection = new Vector3(1,0,1); I suggest you take a look at some basic C# tutorials before jumping into Unity. If this is for a school project or assignment, you wont learn much doing things this way. good luck.
Recommends user100681 · 2017-11 · Game Development Stack Exchange · on “Moving 3D object over Spherical terrain”
If you want to know how it actually works, here is how it can be done in Unity: [this video] i've never used monogame, so i can't really help you with that..
Recommends terreb · 2018-07 · Game Development Stack Exchange · on “Helicopter controller, spherical world with faux gravity”
I followed this tutorial [this video] to create a planet with faux gravity that attracts objects. Further I'm trying to create a helicopter-like controller that could move vertically and horizontally and that when the player presses control buttons this would compensate the faux gravity applied with AddForce to Rigidbody and the helicopter could fly. I implemented that in a way that when player presses buttons faux gravity with AddForce is not applied, but still the control feels very awkward. What would be the best way to compensate the faux gravity to move the helicopter? Edit: I only need it to move in XY plane (so only up/down/left/right). The camera looks on helicopter from its right side. T