Is it possible to have a gravity switch without using raycast?

^ question up here

For my racing game i wanted to have anti-gravity so they can race on the “ceiling” but i dont want to switch out the jump code i already have.

1 Like

@ShadowGaming - If you use motor behaviors and disable the gravity function of an object, you can make it so that the object can switch gravity. This is because game gravity is basically just a universal motor on all objects. The default gravity strength of the game when you first create it is 45 (for y), so if you create a motor behavior with -45 constantly going into the y input, you’ll achieve the same effect (make sure to disable gravity for that object first, otherwise the gravity strength will be doubled). If you use 45, then the object will receive a gravity affect that pulls them upward.
You can use @Latif’s example of switching gravity to help you out.

2 Likes

oh wait, i got it wrong, its not raycast. but thanks!

2 Likes