Various questions: Physics, shadows and lighting

i think this topic is generally important one, since default physics settings works wrong for default world settings. (so it will happen for every new member)

Myself i also use 10units=1meter only just because of physics.

Except for vehicles, the physics simulator expresses all distances in physics-space units. The application programmer decides whether the physics-space units should be meters, feet, cubits, or millionths of a light-year.

And how does the application programmer decide that? How does one actually change the psu?

I’m looking for something like physicsSpace.setPsu(…) but I couldn’t find that

If you set gravity to 9.81 psu per second squared, it will appear that 1 psu = 1 meter.

If you set gravity to 32.2 psu per second squared, it will appear that 1 psu = 1 foot.

That’s assuming that your game takes place in Earth-normal gravity, instead of, say, on Mars.

Ah, so psu is not a setting you can control? It’s a consequence of other settings? That was not clear to me. Sorry for the confusion

It’s something over which you have full control, but there’s no API for it.

Let me try again…

  • Rendering takes place in world coordinates, where (0,0,0) and (0,0,1) are 1 world unit apart.
  • Physics simulation takes place in physics coordinates, where (0,0,0) and (0,0,1) are 1 psu apart.

There’s no API to tell the renderer what the world units are, in terms of meters or centimeters. The renderer knows no units other than world units. It’s the application developer’s job to make sure that models of people and houses are scaled appropriately for whatever world units they select.

Likewise (except for vehicles) Bullet is ignorant of any units other than psu. There’s no API to tell Bullet what a psu is in terms of kilometers or millimeters.

1 Like

But note that the mass scaling and unit scaling are not colinear. As unit scale (to meters) changes mass (to kg) changes at a cubic rate.

Something to watch out for if you think to start from real world units of some kind.

Edit: so in some cases (I’d argue most cases), it can be easier to leave units in meters and kilograms and adjust the other things to make that work. (Note that ‘easier’ does not always mean ‘best’, though.)

1 Like

Bullet doesn’t know about kilograms, either. The Bullet documentation says that masses of bodies should be as close to 1 as possible. The Minie documentation refers to masses being measured in “physics mass units” or pmu.

o_O Can you provide a reference for that?

Seems like a pretty huge limitation if all forces are intended to be completely balanced.

1 Like

Bullet 2.83 Physics SDK Manual, page 35:

Avoid large mass ratios (differences)

Simulation becomes unstable when a heavy object is resting on a very light object. It is best to keep the mass around 1. This means accurate interaction between a tank and a very light object is not realistic.

I wonder if their instability is also related to the fact that I think bullet only does gross estimates of inertia tensors.

In my home-grown physics engine, that was the key to getting a giant sailing ship to behave in non-silly ways when hit by tiny little spheres.

Anyway, today I learned that out of the 20 things I do much worse than bullet, my physics engine does at least one thing better.

2 Likes

Good point about the importance of inertia tensors.

Bullet (and Minie) allow users to customize the inertia tensor of each rigid body, but it’s a fairly advanced topic. In my experience, very few users ever get that far.

Indeed. I have to relearn it every time I touch it and left myself plenty of notes and links to web articles.

Since my objects are made of blocks, I had the advantage of being able to calculate pretty accurate inertia tensors and centers of gravity. It’s just not as straight forward as one might think.

1 Like