Simulate a Repulsion [Solved]

0 favourites
  • 2 posts
  • Hello,

    I'm doing a little test where I want simulate a repulsion, like a snooker ball shocking with another ball, and/or, a spaceship shocking with a hard spaceship.

    The principle is simple, but I can't figure out the math, so, someone can help me, please?

    I think this is something known by Mr. Yann or a Guru of the Math =P

    My last try was to compare the center position of the hit ball and the center position of the ball in movement, when one overlap the other ball, they will split the energy.

    But how we can change their direction to the right direction? using cos and sen?

    Another question, in case of a sprite with squared collision box, how it work?

    Some images to illustrate the problem:

    <img src="http://upload.wikimedia.org/wikipedia/commons/2/2c/Elastischer_sto%C3%9F_2D.gif" border="0" />

    <img src="http://s3.amazonaws.com/magoo/ABAAAenlYAB-0.png" border="0" />

    <img src="http://www.feiradeciencias.com.br/sala05/image05/05_Q4_01.gif" border="0" />

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Solved.

    This is more simple than I was thinking, thanks to Ashley sample template I figured out =P

    Now it's just time to build the best collision system and repulsion.

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