Strategies for creating a physics weight system.

Hey guys,

I’m working on a project where a number of objects have a weight value that I define, as well as a value that indicates the maximum weight the object can sustain. Using the physics engine, I’m trying to make a system where stacked objects impart their weight values onto the objects below them and if the objects below exceed their maximum weight values, the objects break. Additionally, if an object is placed on top of a stack of objects, it applies its weight to the one below it, which in turn applies the combined weight to the one below it, and so on.

Additionally, I’m trying to support the ability to distribute weight amongst more than one object below. For example, if I place an object on top of two other objects, it imparts half of its weight to each of the two objects rather than all of it to one.

As you might guess, I’m having a lot of trouble getting this to work correctly given the available OnCollision functions and whatnot. I’m wondering if anyone has any thoughts on how they’d implement such a system, or whether the physics system has some built-in elements I can be using for this. This is an iphone game, so I’m also trying to decide what is most performance-savvy.

I feel pretty stuck on this, so any thoughts or suggestions would be extremely welcomed and appreciated.

Thanks :slight_smile:

For complex object, I imagine you will need to maintain the set of contact points, take note of the Normals in order to infer which object is pressing down on which others, the distance of the contact point from the centre of mass to bias the weight distribution by, and finally sum up the hierarchy of inferred stacking whenever the contact points change. How realistic the results will be is hard to tell since it’s just a heuristic approach. I used similar fakery once to make objects float and while it was good enough for “game physics”, it didn’t really look true to the real world. If this mechanic is key to your player’s success, they may get frustrated if it is too far from reality.