World Setting [bounce] - Infinite Bouncing/shaking Of P6 Objects

Discussion in 'Technical Discussion' started by Jayson, Jul 18, 2016.

  1. Jayson

    Jayson Boxer

    Oct 19, 2015
    Likes Received:
    Hi there!

    There is this little but annoying problem.
    First, let me illustrate the problem by letting you guys duplicate it. You can turn on debug to see collision shapes better.

    World settings:
    Bounce >= 1
    Gravity = -80y [low gravity - less noticeable but it still happens, high grav - very noticeable]
    Friction = 10-20 [low friction - objects would slide, high friction - you would notice the jiggling more]

    1. Create square objects with square collision shapes.
    2. Set them as physics objects and stack them on a static platform to around 5-10 boxes high.
    3. Play.

    1. Create square object with square collision shape
    2. Set as physics object and set it to fall from a certain height.
    3. Create a square character with square collision shape.
    4. Play.

    Expected result I.:
    > Notice how the boxes wiggle or shake no matter how you make the alignment or the stack perfect?
    > Eventually the stack would collapse because of these shaking.

    Expected result II.: (harder to observe, does not always happen, but it happens)
    > Watch the box fall to the ground and bounce a little. It might or might not show some shaking.
    > Make your character jump over the box. Notice how your character will shake + slide on the box.
    > this happens even when character bounce is set to 0.

    What might be the cause:
    I could be wrong but I suspect infinite bounce with no/very little cut off.

    Say a falling box hitting a floor/fixed platform in a game.

    It's either the box will bounce or not.
    No bounce means the collision is perfectly inelastic. In BB, its Bounce = 0.
    If it bounces but keeps the same height, it is perfectly elastic. In BB, this is Bounce = 100.
    If the bounce is between 0 and 100 in BB, the object will bounce but the bounce height will be lower and lower until it goes to rest.

    For example with the same scenario:
    Elasticity= 0.5/BB Bounce = 50
    Box dropped from 10m
    1st bounce = 5m
    2nd = 2.5m
    3rd = 1.25m
    4th so on.

    In real life, we have so much friction going on, that the bounce from a baketball will just repeat a few times before it goes to rest. It won't bounce 0.00002672m.

    In game physics where everything is ideal, it happens.
    This could also be happening in buildbox.

    If it is the cause of shaking, a cut off might help.

    A cut-off works like this: If the bounce is no grater than X, no more bounce will happen.

    A could be solution:
    > Put one or increase the bounce cut off or
    > A new world setting alongside bounce called bounce cut-off. So users can decide their own cut off. :)

    Why is this even important? You can just put bounce = 0.
    > I'm trying to create a physics platformer with alot of physics objects. With 0 bounce, the world feels dead. :p
    > With bounce > 0, we can't stack p6 objects. They won't stop shaking. Just 2 boxes high, and the one on top will eventually fall.
    > Lesser CPU usage on games with physics + a little bounce. Every physics in-game requires cpu. Imagine the cpu time gobbled by just 10 indefinitely bouncing objects.

    My speculations about the cause of the problem might be wrong. But the problem is really there. :)
    Christoph likes this.
  2. heathclose

    heathclose Miniboss Boxer

    Jan 28, 2016
    Likes Received:
    what about creating one pixel of space between your objects and give them a wake up the size or half the size of the scene they reside in... will they still shake themselves to topple by the time your player gets to them?
  3. Jayson

    Jayson Boxer

    Oct 19, 2015
    Likes Received:
    They will still start shaking/sliding once woken up.

Share This Page