How to get slow moving circle to bounce

stan_mcginnisstan_mcginnis Member, BASIC Posts: 18

I posted this earlier but forgot to put it in question format.
In my game, there is a circle actor which bounces around the scene. There is no gravity, friction or drag in my game, and the only scripts in the actor are a Change Velocity and a Collide behavior to collide with the walls. The bounciness is set to 1, but whenever I set its velocity to 66 or under, it will not bounce!! It will just move along the walls until it reaches a corner and gets stuck. When I set its velocity to over 66 it works fine. Is there any way I can get it to go at a speed under 66 and still bounce?
Also, if it hits a vertical wall at an angle of between 45 and 90, it will not bounce at all, no matter what I set the bounciness to.

Best Answers

  • AlchimiaStudiosAlchimiaStudios Posts: 1,067
    Accepted Answer

    @stan_mcginnis

    Actually Gamesalad uses Box2d for it's 2d physics engine. I just looked at the faqs/gotchas for some box2d documentation and it seems that there is indeed a threshold for minimum movement speed for a collision with restitution (bounciness). So it's just the way box2d comes configured.

    http://www.iforce2d.net/b2dtut/gotchas

    See the section "Why do very slow collisions cause no rebound?"

    Maybe it can be changed by GS staff, but it is possible it might cause problems.

    Follow us: Twitter - Website

  • RThurmanRThurman Posts: 2,859
    Accepted Answer

    @Alchimia Studios -- I always wondered why actors bounce poorly at slow speeds! It never occurred to me that it was a Box2D setting. Just in case GS staff ever want to address the issue, here is the critical sentence:

    In b2Settings.h you can change the default value (b2_velocityThreshold) for the minimum velocity to consider inelastic. Changing this to a much smaller value should not usually cause any problems.

Answers

Sign In or Register to comment.