Mixing Move to(position) with Physics

  • I have a calculated the position of a ball as it is traveling and I want to move the paddle up to meet it. I was using the apply force to position but ran into the issue of over shooting the position. Then I used the move to behavior to accelerate and decelerate to the position.

    So is it a bad idea to mix these two behaviors?

    Alternatively, is there a math concept that can move something at an accelerating rate and then decelerating rate or exponential/inverse?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yes, generally it's a bad idea to mix Physics with other movement behaviors. Sometimes they may work fine, but in games like Pinball or Arkanoid this will definitely cause problems.

    In Physics you can actually stop objects immediately by setting their velocity to 0. You can even fully control them with only "Set velocity" actions, without forces or impulses.

    .

    There is a simple trick you can use - create a clone of the paddle sprite, make it invisible and give it MoveTo or 8direction behavior. Control the PaddleClone sprite, and on every tick set physics velocity of the real Paddle to the PaddleClone speed.

  • Thank you for the tips.

    I have just realized that you can apply negative force to get something to decelerate. apply force for 1 second, then apply -force for 1 second will result in a object moving and then stopping.

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