- Home /
Rigidbody gravity between planets
Hello, i'm doing this 3D game, where you can fly around space and you can land on planets, where you automatically rotate and land on your feet on the planet, wich has bigger gravity (like space engineers), so i don't know how to write the gravity script for the rigidbody if rigidbody already has gravity by decreasing the Y. Please help me (13 year old developer), sorry for my bad english, thanks alot.
Answer by MuffinMan101010 · Aug 12, 2016 at 04:15 PM
KSP huh? Anyways, don't use the gravity scale, make your own.
{
float gravity = -2.4f;
void Update ()
{
rigidbody.velocity.y += gravity * Time.deltaTime;
}
public void ReverseGravity()
{
gravity = -gravity;
}
Heres something you can work out of, I'm also 13 lol!
You could also do
public float downforce = 9.81f;
//the real life numeral value for gravity
void Update()
{
GetComponent<Rigidbody>().AddForce(-transform.up *0f* downforce);
}
Ps im also 13 :P
Your answer
Follow this Question
Related Questions
Make object use gravity without rigidbody. 2 Answers
rigidbody.Use gravity not working from script 0 Answers
How to drag object faster to the ground? 3 Answers
Artificial Gravity 2 Answers
Player in Spaceship 2 Answers