#Easy way to flip the gravity?

6 messages · Page 1 of 1 (latest)

wary ravine
#

I'm trying to put antigravity into my game but I can't seem to figure it out, I want the gravity to flip when the player presses "antigrav_test". If it helps I'm using the script template for the characterbody3d

if Input.is_action_just_pressed("antigrav_test"):
        rotation.z = 9.425
minor parcel
wary ravine
#

However the built in character body script does it I think

minor parcel
#

Then you should be able to identify where that happens and modify that part. Having a variable that's normally set to 1 but you change to -1 when you're in anti gravity would allow you to multiply whatever the gravity is by that variable to invert it when needed

wary ravine
#

I know how to reverse the gravity I just need to figure out how to set to reverse in the code above

minor parcel
#

Like I said, a variable that's usually set to 1 but you can change to -1 would do fine