How do I set max acceleration/fallspeed for physics objects?

0 favourites
  • 6 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • I'm having physics objects fall into a platformer and the height they fall from gives them a lot of time to accelerate, causing them to fall way too quickly. Is there a way to set their maximum fall speed?

    P.S. They fall from various heights, so changing their original height isn't a solution.

  • You can create a maximum speed variable and an event to prevent the object from going beyond the max speed.

    Constant Variable MaxSpeed = 30

    If [your object].velocity > MaxSpeed --> Set [your object].velocity to MaxSpeed

  • Check this example CAPX. Hopefully this helps.

    https://www.dropbox.com/s/lppbeb06fqp1e88/physics%20boxes%20max%20speed.capx?dl=0

  • I'm having physics objects fall into a platformer and the height they fall from gives them a lot of time to accelerate, causing them to fall way too quickly. Is there a way to set their maximum fall speed?

    P.S. They fall from various heights, so changing their original height isn't a solution.

    Here is another method. <img src="{SMILIES_PATH}/icon_mrgreen.gif" alt=":mrgreen:" title="Mr. Green">

    https://www.dropbox.com/s/7s4vs3c8zde0n ... .capx?dl=0

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the responses!

    makotto, I went with your solution. it makes complete sense. I didn't realize you could use a '.physics' of an object. Just didn't occur to me. Thanks!

    Gmoney, I didn't realize that was what the force attribute could be used for, I thought it was literally to apply force on an object as if it were being hit. Though I suppose that's what impulse is for. I don't fully understand what is happening with force.

  • Thanks for the responses!

    makotto, I went with your solution. it makes complete sense. I didn't realize you could use a '.physics' of an object. Just didn't occur to me. Thanks!

    Gmoney, I didn't realize that was what the force attribute could be used for, I thought it was literally to apply force on an object as if it were being hit. Though I suppose that's what impulse is for. I don't fully understand what is happening with force.

    You're welcome, Lumberjack. <img src="{SMILIES_PATH}/icon_mrgreen.gif" alt=":mrgreen:" title="Mr. Green">

    That's what I've found on my own, while experimenting with physics, when I needed to have more than two objects falling with unique velocity.

    To be honest with you, I'm not sure about how the force is affecting the balls to fall slower (or faster).

    I've been using the force to achieve random velocity effects I needed on free falling object instances, in order to get realistic looking free falls.

    I've read Ashley's tutorial below (and C2 manual) to find an answer for that, but I wasn't sure how the force was doing what it was doing in my games. <img src="{SMILIES_PATH}/icon_e_confused.gif" alt=":?" title="Confused">

    https://www.scirra.com/tutorials/65/phy ... and-joints

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