## My bodies do not act realistically like real life?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

### My bodies do not act realistically like real life?

The Newton engine is a very realistic rigid body simulator. This means that the application has the chance to reproduced very realistic behaviors but the level of realism depended on how close the input data reflect reality.

If you see some of the tutorial sample code in most cases the inertia matrix for rigid bodies set arbitrarily uncorrelated values for mass, inertia, and geomtery shape. for example

Code: Select all
`// set the body mass and inertiaNewtonBodySetMassMatrix (ballBody, 1.0f, 1.0f, 1.0f, 1.0f);`

This is done because the focus of the tutorial is not on the calculation of the inertia but on other topic. For correct realistic behavior is very important that a more current correlation between collision shape, mass, and moment of inertia is set properly. For example
For a sphere of mass 1.0, diameter 1.0
The inertia matrix would be: Ixx = 0.4 * 1.0 * 0.5 * 0.5 = 0.1
Which is one tenth of the previous sample

Code: Select all
`float Ixx = 0.4f * mass * radius * radius;float Iyy = Ixx;float Izz = Ixx;NewtonBodySetMassMatrix (boxBody, mass, Ixx, Iyy, Izz);`

Why this is important? It is important because physics is nothing but the balancing calculation of the distribution of energy between bodies in motion.

When you place a ball on a slope and let it go down the ramp. At the beginning the total energy is
Et = M * G * H

M = mass
G = gravity
H = the height from where the ball is to where the ball goes.

If the ball ought to roll down without sliding (not energy lost due to friction)
The total energy of the system must be constant

M * G * H0 = Et = M * G * H + M * v ^2 + I * w ^2 (Ignoring the Â½ for the sake of analysis)

What this means is that as the ball goes down part of the energy lost from losing altitude is converted to linear and angular energy.
However since the ball cannot slide then the conversion of energy is correlated by the ratio between mass and inertia, the higher the moment of inertia the more resistance to roll because a small angular velocity will be enough to balance the equation.

Another way to see this is by just the definition of inertia and mass, it is the resistance of a body to change its state of motion under the present of a external force (wasn't Newton great 300 years and we still banking on that law, even thought some people in some forums are trying to re-invent it, with this pseudo physics that is floating around)
So based on that if a body has a very high moment of inertia and it is at rest, it will offer a great resistance to roll, the higher the inertia the greater the resistance.
So the observation

willThimbleby wrote:I tried the dryfriction joint and I can't say I noticed what it did. One odd thing with the marble rolling, is that if the friction is high the marble never rolls, no matter what angle the slope is. Surely the marble should roll no matter what the friction?

No true if a ball have a very high inertia will not roll at all, and just slide down the slope if it breaks the static friction (if not, it will stay at rest.) If you check on some college text books you can probable find experiments where they place a Solid ball, a hollow ball, and a box in a ramp and let them slide down. The box get to bottom first, follow it by the hollow ball and the solid ball come a last.

That is explained by the above equation which is written below symbolically.

E = M* V^2 + I * W^2

Ve = linear energy
We = angular energy

since the box cannot roll, all the potential energy is converted to linear energy, allowing for a higher linear velocity, therefore if friction is not too high, the box will adquired larger linear velocity.
The hollow sphere can roll, but it has very small inertia therfore very litle resistance to roll which means that large omega have litle effect on the enrgy equation.
The solid ball have larger inertia, so smaller amount of omega is sufficient to balance the equation.

In the end all makes sense, a ball with larger inertia will take longer to start to roll, increase the inertia and it will not roll at all.

Notice that this is not tweaking or massaging the engine, this is just setting appropriate parameters in order to get result that can be compared to reality.
Julio Jerez
Moderator Posts: 11122
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles