Get Rid of Bouncing

Say you have a tower built out of physics shapes. If you build high enough or use enough individual bodies, eventually you will have problems with the tower wobbling or bouncing. This will get out of hand and cause the pieces of the tower to start sliding out of place and even causing the whole tower to fall.

How can I eliminate bouncing in Corona? I have tried setting the bounce to 0 but it horrible compared to box2d’s tradition restitution = 0.

[import]uid: 54716 topic_id: 20085 reply_id: 320085[/import]

Have you tried increasing the density and/or friction of your tower objects? This is probably too obvious, but worth a try. It might not even be what you desire, but if you can increase friction to prevent “sliding”, versus the entire tower collapsing, then I’m sure greater friction would be the desired option. Higher density might also make each object heavier in general, thus preventing them from “bouncing up” by tiny degrees and destabilizing the structure.

I’m curious about what you find out (if anything) because my current game in design might involve some fairly big tower constructions, and I don’t want the same kind of bouncing/sliding behavior occurring. So please report back on your experiments, I’d appreciate it!

Brent Sorrentino
Ignis Design [import]uid: 9747 topic_id: 20085 reply_id: 78434[/import]

Increasing the density and friction is not so much obvious as it is difficult to get working properly. Setting the densities to all the same integers for all the pieces instantly gets rid of the problems, but every piece isn’t the same. If I am building a tower, it needs windows, wooden beams, stone, etc. Having the same densities for stone and glass, just won’t work. Then lets say, you have to hit a switch or something with a particular piece. If the weight of the switch is set to stone, but every piece weighs as much as stone, then every piece could flip the switch.

So with density, its finding the right threshold in which you can still having unique differences between pieces. If it’s too large between pieces, then the bouncing returns. This occurs even with a bounce of 0.00001 and 0. (I seriously need someone to check and see if bounce = 0 is even valid)

Concerning friction, how high does friction have to be??? I have bodies with densities at 1 with frictions from 100 to 400. Friction forces don’t act like I thought they would. I thought frictions this high would stop the bouncing. Frictions only seem to effect simple things like giving traction to round objects and stopping pieces from sliding down hills. I will try boosting it some more just to see what happens.

I think I might hit a wall with the threshold, and will then have to come up with more elaborate solutions. I will keep you posted. [import]uid: 54716 topic_id: 20085 reply_id: 78512[/import]

Maybe also play with

linearDamping

ie :

myObject.linearDamping = 1000 [import]uid: 84637 topic_id: 20085 reply_id: 78944[/import]

Doesn’t linear damping interfere with gravity?

Also, once I have a decent batch of settings made on the simulator and I drop them on the phone, I still get problems with the physics. I think the problem lies in set scale.

I have my game set of for ZoomEven. If the game is zoomed, shouldn’t the physics act the same? [import]uid: 54716 topic_id: 20085 reply_id: 79311[/import]

Yes, linear damping does interfere with gravity… in a scenario of objects “in air” (not on a physical surface), then it would be like an “air friction” sort of effect.

How are your experiments with friction going? The Corona docs suggest that friction of 1.0 is “fairly strong friction” but I don’t know if that is the maximum value or not. My suggestion of increasing the friction to obscene levels (1 million?) wasn’t so much about preventing the bouncing you’re experiencing, but the “sliding” that you described. I thought maybe if you reduced the sliding, then the objects might stop (by friction) very quickly and stop producing minor bouncing effects which are destabilizing your towers.

Unfortunately, physics in Box2D can be tedious and annoying to deal with. This is true for Corona and Cocos2D and basically all platforms. When these platforms report that they feature “real-world physics”, that’s a fair exaggeration. They simulate reasonably close real-world physics, but all of my tests in various apps over the past 1-2 years has proven that it’s anything but “real world”. Sadly, as developers, we can only do our best to compromise and find a decent setup that seems about right. It’s frustrating, yes, but I don’t know if even huge-budget games from major studios on XBox, PS3, etc. feature truly real-world physics. :slight_smile:
[import]uid: 9747 topic_id: 20085 reply_id: 79326[/import]