Detect when a physics object has stopped

0 favourites
  • 5 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hey folks, trying to determine how to detect when a physics object has stopped moving. I've tried to use the velocity, x velocity, y velocity, but I've noticed that these values are constantly changing in the debugger. Here is my capx, just hit the bottom DICE button and watch. The dice should display their result once they stop moving, only works for some dice.

  • ummm how about you start using stable releases instead? betas always have some bugs (not necessarily physics).

    also have you set your gravity to 0 ? if velocity isn't 0 is there a force working on your dices?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Compare velocity

    Compare the current velocity (speed) of the physics body, in pixels per second. The velocity can be compared on an individual axis, such as just the X axis to compare the horizontal motion, or the overall velocity can be used.

    comparing the velocity to a range of low values could be done, and if you reach said value, you stop the object completely, and that is fine (I think the overall velocity could be used)

    I am downloading your capx to see

  • squizm

    I replaced one of your events, the 5 and 6, it seems to achieve a nice effect!

    (see the attachment)

    First, the for each was not needed (the conditions already apply the actions for each individual objects due to how the C2 engine works)

    Then we check if the objects is not moving too much in term of Y and X velocity, and we also check if the object is not spinning too much (the values are empiric, it just looked good).

    I make them unmovable because I do not want them to continue to move just in case..

  • Fantastic. This worked. Thank you very much for your help.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)