[SOLVED] Chipmunk Physics: Bounce off object

0 favourites
  • 5 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • So, I'm still challenging my (non-existant) math skills with a pool game.

    Currently, I'm having issues with bouncing the balls off the pool table edges.

    I'm using the Chipmunk physics plugin by R0J0hound, so you probably have to be quite familiar with that to help me.

    (I tried using bullet behaviour for the balls with "bounce" enabled, doesn't work, since bullets don't bounce off bullets)

    (I tried using the normal physics, that misses features that I need, like kinetic energy on impact)

    (I tried using chipmunk for impact expressions and bullet behaviour for bouncing off, doesn't work since bullets still don't bounce off each other and bullet & chipmunk don't work together anyways)

    So what I need is an action that I can use to bounce a ball off another object manually.

    Currently, I have this

    after a "On post collide" event.

    That setup is probably total bullsh*t, but this is my first time using CM physics and I am in no way appropriately familiar with the plugin to figure the out the correct parameters.

    (Believe me, I spent hours trying out setups and constellations of parameters)

    Any help is appreciated, thank you.

  • The bouncing should be handled by the behavior itself. Just give the objects the chipmunk behavior and make the edges have the immovable property. Setup should be identical to the built in physics behavior.

    To make everything bounce like pool balls, set the elasticity to 1 on everything. The apply impulse action is only needed to initially launch a ball. No math is needed.

    You can calculate the KE of a collision with the physics behavior with a little math, but that's mainly just useful to adjust the volume of the hit sounds.

  • Ahh... elasticity to 1 for every object..

    How could I overlook that. Sometimes it's the small things that make a difference.

    (And yeah, I tried to use the Apply impulse action to simulate bouncing off, not for anything silly )

    Thanks for your help.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • randomly or R0J0hound , any idea why is the CM physics has the jerking in movement at low speed? im experiencing some weird "shakings" i bet its from stepping however if i decrease the stepping mode everything falls apart. since accuracy detection wont be handled with precision anymore. Any tips?

  • Just guess but by default the stepping mode is fixed which means the timestep will be the same for every frame. So if the actual dt varies a lot frame to frame you'll get that jerking. You can change the stepping mode to variable which should help eliminate that.

    If it doesn't help then I'd guess an object with the bullet behavior moving at the same speed will have similar jerking. It's something that has come up before, and it's caused by how the browser used deals with your current hardware.

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