Unwanted physics objects overlap?

Hi folks,

I am working on a word game with tiles that the user can drag around the board. If you drag a tile into other tiles those tiles get pushed out of the way. However, if you move somewhat quickly (not even very quickly) the tiles overlap slightly as they get pushed. And if you use a tile to push another tile (or bunch of tiles) up against the edge of the screen, the tiles can be made to overlap quite a bit. This makes the tiles seem pretty unsolid and non-tile-like. :slight_smile: Is there a way to make them behave more like solid objects?

I tried body.isBullet=true, but that didn’t seem to make any different.

Thanks!

Jim
[import]uid: 71732 topic_id: 20086 reply_id: 320086[/import]

Take a look at this and see if it helps; http://blog.anscamobile.com/2011/08/solutions-to-common-physics-challenges/

Are the bodies falling asleep, perhaps? [import]uid: 52491 topic_id: 20086 reply_id: 78459[/import]

I had this problem once… I just gave customized physics shapes for each body,slightly bigger than the original shape… So the overlap will be there but only on the ā€œextra physics partā€ which will not be visible…

Hope that made sense… [import]uid: 64174 topic_id: 20086 reply_id: 78513[/import]

Thanks for the replies folks, I appreciate it! I have been trying the various approaches suggested, and it improves the situation, but doesn’t fix it completely. Or at least I have not hit on the correct combination of variable settings yet. Surprisingly fussy work. I would not have thought getting square tiles to behave like they are solid would prove to be so tricky!

I’ve jacked setPositionIterations and VelocityIterations up to 128, and for each tile have isSleepingAllowed=false and isBullet=true, but they still overlap a bit when pushed even a little fast.

I have also tried creating a buffer shape around each tile. This also helps, but still hasn’t solved it. I can tweak further. I am limited a bit by the fact that if I make my tile buffer shape too large then the pieces can’t sit on adjacent spaces on the board.

Thanks again!

Jim [import]uid: 71732 topic_id: 20086 reply_id: 78627[/import]

I’m also having trouble with this.

I’ve jacked positionIterations and velocityIterations up. I’ve increased physics:setScale to 100. I’ve changed all the objects to isBullet true and sleepingAllowed false. Yet still my objects (triangle custom shapes) overlap, even when there are only two on screen and they are moving at a moderate pace.

I feel like the problem is with my custom shape. Does anyone else have this problem or does anyone have a fix?

Nick [import]uid: 7472 topic_id: 20086 reply_id: 90011[/import]

Hi Nick,

Just wanted to let you know that I never fully resolved this. A combination of the suggestions above improved the situation, but I never did find a solution that made my tiles actually behave fully like tiles (not overlapping, not switching places if you drag them a little too fast).

Jim
[import]uid: 71732 topic_id: 20086 reply_id: 90266[/import]

Thanks for your reply, Jim - I’m sorry you never fully solved your problem.

I may have solved my problem if it would be useful to anyone else - I’m using a custom shape (a triangle) that was defined as

triShape = {0,0, 100,-100, 200,0, 0,0}

As you can see, I was repeating the first vertice to ā€˜compete’ drawing the shape. Turns out you not only don’t need that trailing 0,0, but I think it might have been what was causing my problem (it seemed like one of the sides of the triangle wasn’t being recognized at all).

Nick [import]uid: 7472 topic_id: 20086 reply_id: 90269[/import]