Ball-sprite sticking to wall-sprites at low speeds

Get help using Construct 2

Post » Mon Apr 20, 2015 8:16 pm

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?
B
5
S
1
Posts: 2
Reputation: 386

Post » Tue Apr 21, 2015 12:02 am

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. :)
B
8
S
2
Posts: 39
Reputation: 604

Post » Tue Apr 21, 2015 7:46 pm

Thank you very much, @Cam112549! It worked. It's still not perfect, but at least the ball doesn't stick to the walls completely.
B
5
S
1
Posts: 2
Reputation: 386

Post » Tue Apr 21, 2015 11:39 pm

Definitely, I'm glad that I could be of service, and I hope that you continue with construct 2. :) @mndxpl
B
8
S
2
Posts: 39
Reputation: 604


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 9 guests