Circular Object on Dynamic Object rolls off.

I've tried rotational damping and linear damping to solve this, but either they just delay the inevitable (circle rolls off) or prevent it from moving even when things (i.e. damped so much nothing can move them)

Here's the easiest way I can think of to explain the problem:

There are a lot of dynamic objects built up, like in the EggBreaker or Ghosts vs Monsters examples.

The player has to do something to knock them down.

Now, look closely at any of the eggs sitting atop a non-static ground object in EggBreaker. Or change the Tombstone at the top of Ghosts vs Monsters to be a round object.

Because the dynamic objects below them are not "perfectly" balanced 100% of the time (even if they look like it), the circular object will ever so slowly roll in one direction or another until it falls/hits a wall.

What's the best way to solve this problem?

I'd have to have a play around to come up with something a bit more solid, but is there any chance that setting them to fixed rotation until collision == "began" could work for you?

I thought about this as a potential solution as well, but didn't believe it could be done without causing circular objects to behave awkwardly.

One problem would be that the condition would ring true immediately because it would be resting on top of another physics object, but that collision could be filtered out or the listener could have an ever so slight delay in being setup to get around this.

The real deal breaker though is that it requires the circular object to "get hit". In other words, hitting the dynamic objects holding it up would not cause it to move because rotation would be fixed. The dynamic objects below it would have to get knocked over enough to collapse, the circular object to fall, and only then once it made contact with another object or the ground would it begin to roll.

You might get away with it here and there, but the user is going to notice the circular objects behave "awkwardly".

So far, the best idea I've come up with (but haven't tried) is to replace circular objects with hexadecagons, but I really, really want to avoid that if at all possible.

This might work (no time to try it right this moment):

Make all your stacked items "static" and insert them into a table. Immediately upon the first collision (registered to and listened for by your projectile), iterate through the table setting all bodies to "dynamic". Then and only then should the circle start to roll, even if you hit another object first.

If you need code for this let us know. If no one responds by the time I return later I'll through something up.

views:1508 update:2011/10/4 8:06:35
corona forums © 2003-2011