Physics - smooth rolling on a half-pipe shape?

Get help using Construct 2

Post » Fri Jan 27, 2012 6:39 pm

I'm starting to look into physics for the first time, and since I've ventured out of the familiar territory of platformers, I've reverted back to newb status.

The first thing I tried to do is make a half-pipe shape, like a bowl, and have a ball roll along the inside. However, in the example I posted below, it doesn't roll smoothly. Its collision mask is set to circle, so I assume the problem is with the half-pipe itself.

Speaking of which, I ignored the "You should only have 8 points in the collision polygon!" rule and bumped it up to... *cough*... 19, just to see if that would make it roll smoother. It sort of did, but it's still not quite there. I assume I shouldn't be adding even more points. You'll also notice the ball kind of goes through the half-pipe on the right side, I have no idea why that happens either.

http://db.tt/HKn2g4sK

Any advice?
B
20
S
9
G
6
Posts: 607
Reputation: 6,112

Post » Fri Jan 27, 2012 7:38 pm

You could splice up the half pipe and redistribute it over several objects of 4 to 8 points max each. (avoid making it as animation frames of the same object, there's a bug preventing it (using only the collision mask of the first animation frame))

But to be honest, apart from the right-side bug, it looks pretty ok.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,795

Post » Fri Jan 27, 2012 7:41 pm

Agreed! I personaly think you should just ignore the litte "bumps" and claim it on the virtual material of the pipe and the ball ;-)
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Fri Jan 27, 2012 7:46 pm

Yeah, just discovered that animation frame bug myself, haha. I just tried splitting it into two halves, each with 8 points, but it still has some issues. I'll try splitting it up a bit more.
B
20
S
9
G
6
Posts: 607
Reputation: 6,112

Post » Fri Jan 27, 2012 8:18 pm

The bumpiness is mostly taken care of, but the bug on the right side is still there. That sprite is just a flipped clone of the one on the left, why would this happen?
B
20
S
9
G
6
Posts: 607
Reputation: 6,112

Post » Fri Jan 27, 2012 9:34 pm

It appears that the bug is because the collision polygon for the halfpipe is concave. According to this the Box2d engine needs the collision polygons to be convex to function correctly.
B
79
S
24
G
54
Posts: 4,746
Reputation: 40,755

Post » Sat Jan 28, 2012 1:14 am

Why dont you just use 1 invisible block (multiple copies) for detection ?
I used this method in quite a few projects....without a performance hit.

B
19
S
6
G
7
Posts: 1,206
Reputation: 7,300

Post » Sat Jan 28, 2012 9:56 am

The pyhsic engine seems to be quite buggy - as I found out and also reported. Depending on the shape of the collision polygone the enginge shows very "unpredictable" behaviour
B
42
S
19
G
12
Posts: 723
Reputation: 13,911


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 17 guests