Physics - smooth rolling on a half-pipe shape?

0 favourites
  • 8 posts
From the Asset Store
Simple yet very life-like rag doll made with Physics!
  • 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. <img src="smileys/smiley36.gif" border="0" align="middle" />

    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. <img src="smileys/smiley17.gif" border="0" align="middle" /> 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.

    db.tt/HKn2g4sK

    Any advice?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • Agreed! I personaly think you should just ignore the litte "bumps" and claim it on the virtual material of the pipe and the ball ;-)

  • 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.

  • 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?

  • 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.

  • 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.

    <img src="http://dl.dropbox.com/u/22173473/detector.png" border="0" />

  • 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

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