- Home /
Answer by Eno-Khaon · Jun 11, 2021 at 09:33 PM
That's quite... vague... but the basic implementation of gravity would look something like this:
void FixedUpdate()
{
rb.velocity += Physics.gravity * Time.fixedDeltaTime; // In PhysX, Acceleration ignores mass
float rigidbodyDrag = Mathf.Clamp01(1.0f - (rb.drag * Time.fixedDeltaTime));
rb.velocity *= rigidbodyDrag;
transform.position += rb.velocity * Time.fixedDeltaTime;
}
Answer by Programmingat23505 · Jun 11, 2021 at 09:35 PM
I don’t know what your using it for but here is a video for a pretty basic implementation, start and 15:00. This works as long as your object has a transform component, it has to anyways. If you are not using or a character controller you can use transform.translate instead of character controller.move!
By the way, transform.translate doesn’t use physics, so character controller works too.
@AryalsMe