Ball-sprite sticking to wall-sprites at low speeds

0 favourites
  • 4 posts
From the Asset Store
Wall Pin Board is a hyper causal game developed for fun and inspired by YouTube video whose link is given in description
  • Hello everyone! My first post here .

    I picked up C2 literally few days ago (still free version, planning to buy full one soon), and I like it very much so far. But I think I found a problem I can't handle myself.

    Here's a simple capx: mega.co.nz/#!3s9XRKBS!qTCbVq9UAwlH9NeRa8oajq1si0j0xERZ06nbX2CK5fM

    When you run it, you'll see that the ball "sticks" to both walls, instead of bouncing off them. I tried to give different values to Friction and Elasticity (both walls and ball), but it does not seem to help.

    However, I've done some searching and it appears to be related to Box2d, not C2 itself:

    stackoverflow.com/questions/5381399/how-can-i-prevent-a-ball-from-sticking-to-walls-in-box2d

    box2d.org/forum/viewtopic.php?f=4&t=4134

    According to those posts, the solution is to set b2_velocityThreshold to 0 in Box2d config.

    Construct2 has two versions of this engine, both in directory "Construct 2\exporters\html5\behaviors\physics".

    The "normal" one runtime.js does indeed allow to change configuration options (including b2_velocityThreshold in line 76).

    But there's also runtime-asm.js, which is minified to a format, that doesn't allow to change anything, or at least it's too hard for me.

    "Unfortunately" C2 uses the latter by default.

    So, how do I make a ball bounce off the walls, while it moves slowly?

    Am I missing something, and we can change Box2d config somehow, or is there maybe another way?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It is because you are preventing the objects rotation, set prevent rotation in the physics properties to no. Since it is moving so slow, it might roll a bit on the wall. Hope that helps, comment again if you need more info.

  • Thank you very much, Cam112549! It worked. It's still not perfect, but at least the ball doesn't stick to the walls completely.

  • Definitely, I'm glad that I could be of service, and I hope that you continue with construct 2. mndxpl

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