I want to make a gravity Lift

Hi,

my goal is it that my characters gravity is -1 or something while i collide with a box.

So… I created a box collider and check if its my player who collides with it. if yes, i set the bool “triggered” to true:

When my player dont collide with it anymore i set the bool to false:

image

Ok. Thats the basics.

Now i take the gravity of my player and multiply it by -1.

I thought its a simple solution to make a “while triggered is true” - loop but my problem is:

  1. the result is an infinite loop error
  2. When i remove the while-loop it only works 1 time. He just fall thru the Box collider when i reached the end

Got it…

The solution was:

my box collider was too big. I had to make it smaller and decrease the amount of gravity.

2 Likes