I see you are using the same setup I used in the demos, but the demos are made to show Newton in the worst possible settings and show that it is still stable.

In your code, these lines are setting the mass and the inertias to arbitrary uncorrelated values and that break the realism.

- Code: Select all
`// set the body mass and inertia`

NewtonBodySetMassMatrix (ballBody, 4.0f, 4.0f, 4.0f, 4.0f);

For good behavior you most do like this

- Code: Select all
`float Ixx = 0.4f * mass * radius * radius;`

float Iyy = Ixx;

float Izz = Ixx;

NewtonBodySetMassMatrix (boxBody, mass, Ixx, Iyy, Izz);

For example for a ball of radius 0.5 and mass 4.0:

Ixx = 0.4 * 4.0 * 0.5 * 0.5 = 0.4

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 form 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 your 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? Am I doing something wrong?

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

The box just slides down so all the potential energy is converted to linear energy, allowing for a higher linear velocity.

The hollow box has very small inertia and very little resistance to roll which means W must grow faster to balance the equation.

The solid ball have larger I, so smaller amount of W is sufficient to balance the equation.

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

To conclude, set the inertia correctly, set the viscous friction to zero, and use a rolling friction joint and everything should be OK. Notice that this is not tweaking or managing it is just setting appropriate parameters in order to get result that can be compared to reality.