How to change the gravity of my scene?
In my game I've got 2 scenes: One called Outer Space --> Where my spaceship flies, and the another scene called Planet --> where my ship lands.. And as I started working in the first scene, I changed in the Project settings the gravity to 0 and when I went to my planet all my things started flying.
SO,THE QUESTION IS how to set the gravity in my planet (scene) to 9.81 m/s^2 if I want the Outer space gravity = 0?
Thanks!
Answer by ClearCut_Games · Aug 10, 2016 at 03:04 PM
Hey you can use a script in the scene that implement this method When you can insert in both scenes. Scene 1 as 0,0,0 Scene2 as 0,9.3f,0
c#
[SerializeField]
private Vector3 newGravity;
private void Start()
{
Physics.gravity = newGravity;
}
or UnityScript :
Vector3: newGravity;
function Start()
{
Physics.gravity = newGravity;
}
Answer by adrianfrancisco · Jan 02 at 09:33 PM
It could be easier to just change the gravity scale in the inspector, in the Rigidbody component
Your answer
Follow this Question
Related Questions
Physics for ball on an incline: rolling up a hill if half way up 1 Answer
Non-centered gravity 0 Answers
Changing gravity depending on character/camera rotation 0 Answers
Unity Faux gravity on a cube: reaching some faces is troublesome 0 Answers
Rigidbodys velocity resets to 0 upon reaching -11 while falling close to another object 0 Answers