How does gravity work under the hood in the physics engine?
When you set the world gravity, what exactly happens under the hood?
If I wanted to replace the built in gravity with my own, and have the behavior look identical to Unity's gravity, would the code be this simple, or is there more going on each tick?
void FixedUpdate() {
const float gForce = -9.81;
Vector3 gravityVector = new Vector3(
0.0f,
gForce * Time.deltaTime,
0.0f
);
rigidBody.AddForce(gravityVector);
}
Comment
Your answer
Follow this Question
Related Questions
Non-centered gravity 0 Answers
Physics for ball on an incline: rolling up a hill if half way up 1 Answer
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
how would I make a capsule rotate and go down a platform on the y axis? 0 Answers