## concepts about how the 'mass' of an entity, affects it in a physics engine

Started by RemiD, November 05, 2023, 16:26:57

#### RemiD

hi

i am searching for concepts / explanations about how the 'mass' of an entity, affects it in a physics engine.

for example, how the same force (wind force of the tornado) would affect an entity differently, depending on the main material of the entity (concrete or metal or plastic or wood or leaf ) (which have different weights).

a simplified approach would be to decrease the influence of the wind, on the entity, depending on the weight of the entity (disregarding its size or its attaches to others parts).

i am searching on the internet at the moment, but if you have some good articles / videos / suggestions, please share.

thanks.

#### Derron

I consider remembering your school lessons will already help - and you partially did already.

> how the same force (wind force of the tornado) would affect an entity differently, depending on the main material of the entity (concrete or metal or plastic or wood or leaf ) (which have different weights).

There is "force" (wind, gravity, ... ) and there there are "force emitters" (eg the force of wind in a pipe has the emitter size of the pipe diameter ...)
For games you might want to avoid "small" emitters and consider "wind" to be "everywhere".

The element being affected by the force has energy. The material of the element defines the density. A wooden cube is lighter than a iron cube of the same size.
The the kinetic energy too (if not moving) but as you might remember there exist other energies too.
Potential energy is the one of interest here. Potential Energy is "E = m * g * h"

The energy the force (wind...) is able to "throw" at the target (our cube) has a value which you can calculate according to the "type" of force.
Wind movement is "kinetic energy" and thus the Energy is "E = 1/2 * m * v^2". The faster the wind (with it's "constant" - not really true - mass) is the more energy it holds.

Newton's third axiom tells us that once the wind hits the target "both" are affected by it (so this leads to the wind becoming "slower" - loosing energy).

Back to the target ... the material defines the "density" and if you had 2 same-sized cubes - one out of iron the other out of birch wood you would have 2 different potential energy values (iron one is way higher).
Both have the same "size" so if you could calculate how much "wind energy" will hit a specific "area" (eg "x energy per square meter") you could use that to your benefit.

I told you to remember your school lessons?
Energy is not lost ... it can only be transformed. Potential Energy + Kinetic Energy + Rotation Energy + Heat + ... = X
If you want to keep "x" the same and you want the element to move (kinetic energy) then some other energy "component" needs to get lower.
Means if you have a stone which you throw into the air ... it will increase the potential energy (h becomes higher) but the kinetic energy gets lower (it climbs into the air less and less per second).
Somewhen the kinetic energy is "0" (the point of "return") and then the potential energy gets lower again (h decreases) and kinetic energy raises (speed gets higher).
As "air" has "friction" you give some energy to it - this together with "dampening" is what makes the rubber balls jump less high with each bounce...

Ok so back to "wind" and "cubes":
The energy of the wind hitting the cube will lead to the cube (potentially moving). The cube has potential Energy (holding it "down") and the material might have friction (depends on the ground material) which needs to be "overcome" too.
At the end you can calculate what is "left" after subtracting the friction and "holding it down" forces (attention to gravity ... moon vs earth etc). Keeping it simple it means that the left over energy could be used to "move" the element.

If the wind energy is too low to overcome the forces keeping the cube at it's position ... then it won't move. (but an additional force - eg someone trying to "push" the cube - would have it easer to push then as forces "accumulate").

bye
Ron

#### RemiD

thanks for  the explanations even if i don't understand much of what you say.

what you call 'potential energy' is due to what ? gravity ? or weight depending on the material ?

if i simplify it to the max, not considering the differences in sizes or attachs to others entities or friction, lighter materials should go higher / more far, whereas heavier materials should go lower / less far.
correct ?

#### STEVIE G

I think you just simplify to F=MA so A = F/M meaning you apply acceleration equivalent to the force * inverse mass of each object. Also look up the rotational equivalent Torque. I don't think you want to be too complex here as its not a simulation?

#### STEVIE G

Best to store inv mass for each object, rather than mass, as you can set this to zero for immovable objects.

#### RemiD

i experimented using a pivot + a renderer for each part, so that i can move the pivot (similar to linear direction + speed) and turn the renderer (similar to angular / torque + speed) and use a different weight for each material, which modifies the move speed up (how much the part is pulled pushed by the tornado), then the part goes up and outwards, and when far enough from the tornado it falls with gravity speed.
and when the part reaches the level of the terrain or of the water, it becomes static.

i think that it looks convincing enough for this small game...

#### Derron

#7
Quote from: RemiD on November 05, 2023, 17:17:44what you call 'potential energy' is due to what ? gravity ? or weight depending on the material ?

Potential energy is energy an object "holds" for being somewhere. So to say "location based energy". Hold a ball in your hand - because you lifted it up, it has the potential energy "E_pot = m * g * h" with g being a location factor (on earth it will be around 9,81 - think of gravity!).

Quote from: RemiD on November 05, 2023, 17:17:44if i simplify it to the max, not considering the differences in sizes or attachs to others entities or friction, lighter materials should go higher / more far, whereas heavier materials should go lower / less far.
correct ?

No. If you simplify it "to the max" and just go about "mass" you fully ignore sizes. A simple 40cm x 40cm x 40cm cardbox weights some grams but has maybe the same weight as a spoon (maybe 10cm x 2cm x 1cm).
Lifting up both requires/"consumes" (almost .... but for now we ignore friction of air) the same amount of energy.
But you might have issues grabbing the card box with a single hand (except you are a basketball player .
Now wind also has some energy to spend - and it is way easier to hit the 40x40 cm surface (assume wind comes straight from the side) then on a smooth spoon surface.
Also think about what happens if you place a smooth round barrel with the same weighted (but so less density) qube of the same "max diameter".
-> https://en.wikipedia.org/wiki/Drag_(physics)

So even in a simple simulation: do not just use "mass", always consider density (as same "mass" but half "density" means the object is double the volume), basic shapes (ball vs dice), basic friction (movement on ice vs ground) - and in most cases gravity (you want elements to land on ground again)

For a game I would think of the tornado having a kind of "movement vector" at the position of the "collision". This movement is added to the movement of the hitting object. If you also add some kind of "keep it in the tornado" movement (centripedal force). This makes an object swirl with the tornado.
Depending on forces/values you use an object would only ever leave the tornado once the tornado dies (or you maybe use different values depending on the "height" inside of the tornado). Or you can leave it once you "want to leave" force is higher than the "keep it in the tornado" forces.
Once left only gravity (ignoring air friction) is applied each second (like a thrown ball) and it is up to the object to stay in air (having their own "lift" force - hot air ballon, helicopters ...).

Anyways in a (simple) game it just have to look convincing, it must not be physically accurate. A Tornado will have to "swirl around" an object and letting it loose somewhen if eg the player "accelerates" long enough. Not more not less.

bye
Ron

#### RemiD

QuoteFor a game I would think of the tornado having a kind of "movement vector" at the position of the "collision". This movement is added to the movement of the hitting object. If you also add some kind of "keep it in the tornado" movement (centripedal force). This makes an object swirl with the tornado.
Depending on forces/values you use an object would only ever leave the tornado once the tornado dies (or you maybe use different values depending on the "height" inside of the tornado). Or you can leave it once you "want to leave" force is higher than the "keep it in the tornado" forces.
Once left only gravity (ignoring air friction) is applied each second (like a thrown ball) and it is up to the object to stay in air (having their own "lift" force - hot air ballon, helicopters ...).
yes i have simplified it to the max, and finally i have not considered the weight or the size of the parts.

the clouds go down at the center of the tornado and crashes on the ground / water.
this causes damages to the things in the environment and creates parts (debris) and dust.
the parts / dusts are moved up in the air and whirled around the tornado and pushed outwards.
when the dust are far enough from the tornado, they dissipate.
when the parts are far enough from the tornado, they are moved down by the gravity until they reaches the ground / water.

it looks convincing enough imo.