Jump to content

Gravity scale update delays for one timer step


NumberOneRobot
 Share

Recommended Posts

Hello,

 

I've been trying to make ground collisions for my using sensors, which means I've been having to handle collisions with the ground myself. I tried a couple things, first, I tried simply setting the velocity to 0 once I landed on the platform, but I would continue to fall through the platform.

 

What I'm trying now is setting the gravity scale to 0, and the vertical velocity to 0 when I hit the ground. Then, when I detect input that'll make me leave the ground, I set the gravity scale back to 1, and the velocity is set based on the input. The problem is that when I hit the ground and set the scale and vertical velocity 0, my velocity isn't 0. It's 26.xxxx, which I believe is the speed from one tick of the gravity force being applied.

 

I don't understand why this is the case, since I 0 the velocity  and set the gravity scale to 0, I don't think it would affect the gravity to make it non-zero. Is the physics gravity applied later, and the gravity scale not upgraded until later in the physics loop? All my changes are in my contact event handler, and I don't know where that is in the physics loop hierarchy.

 

If there is a better way to do these ground collisions, please let me know. I want to be able to drop through the platforms as well as land on them, and this is the best way I can come up with to do that.

 

Thanks!

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...