Physics Scale

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Lyrical
Posts: 7
Joined: Fri Mar 19, 2010 4:40 pm

Physics Scale

Post by Lyrical »

I'm using 3DSMax to generate my buildings and their interior models which is working great
I generally use a scale of 1 physics unit to 1 meter

XNA i believe uses 1 unit to 1 centimeter.

I'm getting confused to which is the best scale for both my model and BEPUPhysics.

Can somebody please clarify the scale i should be using to get best performance from BEPUPhysics.

I appreciate BEPUPhysics may use a generic 1:1 anything but having the models too large produces slow physics where a sphere fired like the demo
seams to be moving in slow motion.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Physics Scale

Post by Norbo »

The main consideration when setting up the physics scale in the game is floating point precision. The general case collision detection is sensitive to the limited accuracy present in a 32 bit floating point number. Some specialized collision detection pairs like Box-Sphere or Box-Box deal with the accuracy issue better, but it's best to stay within what the general case can handle well.

This means staying within some range for individual entity dimensions. Something like 0.5f to 10 units is very safe. Usually, you can safely leave that range a little, but if you push it too far with microscopic objects or 1000x1000 triangles strange behavior will creep in.

Creating a content path from a modelling program, through its exporter, into the content pipeline and into your game while maintaining appropriate dimensions can be a little tricky to get right the first time. A lot of odd configurations can sneak in during the process. Usually it's best to mess around until you find a path that works (produces the appropriate dimensions within the game itself) and stick with it.

When scaling simulations up or down, you also need to take into account more than just the objects' sizes. For example, in the sphere example in your post, the gravity/velocities involved would need to be scaled as well to prevent the appearance of slow motion. They're not really moving in slow motion; they're just flying through a relatively vast landscape that makes them look slow.

A little more information (about this topic and others) can be found in the "Applying Physics Engines" presentation on the documentation page (http://www.bepu-games.com/BEPUphysics/documentation.htm)
Lyrical
Posts: 7
Joined: Fri Mar 19, 2010 4:40 pm

Re: Physics Scale

Post by Lyrical »

Many thanks for the excellent explanation.
Post Reply