So, I’m trying to make a mechanic where I can flip the gravity of my character
Heres the code:
void ChangeGrav()
{
if (Input.GetKeyDown(KeyCode.E) && !flipped)
{
rb.gravityScale = -0.7f;
flipped = true;
}
if (Input.GetKeyDown(KeyCode.E) && flipped)
{
rb.gravityScale = 0.7f;
flipped = false;
}
}
And for some reason, when flipped = false, the gravity flipping isn’t working. I’ve tested the other way (when flipped = false and gravityScale = -0.7) and for some reason the flipping is working then. Even though the controlling variable (flipped) isn’t set true. Please help!