PhysicsEngines

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(Physics Testing Videos)
 
(108 intermediate revisions by 17 users not shown)
Line 1: Line 1:
There are several physics engines available for use in OpenSim. Currently, they are "basicphysics", "OpenDynamicsEngine", "RealPhysX" & "BulletX" (modified version). The plugin "basicphysics" is the default and can be seen in the <tt>OpenSim.ini</tt> file.
+
{{Quicklinks}}
 +
== Introduction ==
 +
'''Note: Much of this page was written in November 2009. The OpenDynamicsEngine OpenSimulator plugin is not currently under any significant active development as the [[BulletSim]] physics plugin will likely become the default in the next release of OpenSimulator. However, as of OpenSimulator 0.7.6, [[BulletSim]] is still considered experimental.''' -- [[User:Justincc|Justincc]] 20:45, 19 November 2013 (UTC)
  
* When starting OpenSim in either Windows or Linux, one can add <tt>-physics=OpenDynamicsEngine</tt> to run the OpenDynamicsEngine (ODE) instead of basicphysics, or change the corresponding parameter in <tt>OpenSim.ini</tt>.
+
'''Note: [[BulletSim]] has become the default. Refer to the [[BulletSim]] pages for setup and operation''' -- [[User:Misterblue|Misterblue]] 17:54, 06 June 2014 (UTC)
  
* When starting OpenSim in Windows, one can add <tt>-physics=RealPhysX</tt> if one has the appropriate DLL's which are not shipped with OpenSim due to license constraints.
+
The physics engines currently available for use in OpenSimulator are "basicphysics", "POS" and "OpenDynamicsEngine". As of OpenSimulator 0.6.9, the plugin "OpenDynamicsEngine" is the default and can be seen in the <tt>OpenSim.ini</tt> file.  
  
* When starting OpenSim in either Windows or Linux, one can add <tt>-physics=modified_BulletX</tt> to run a modified version of the BulletX Physics Engine aka ''Modified BulletX''. See the next [[PhysicsEngines#Modified BulletX|information]] about details and progress.
+
ODE has received the bulk of testing. As of 2010 it supports collisions with all prims (cubes, spheres, cylinders etc) with any combination of distortions including hollow, taper, twist, path cut etc. In combination with Meshmerizer it also supports correctly colliding with sculpted prims.
  
To conclude, basicphysics & OpenDynamicsEngine both are appropriate for Linux and in addition, RealPhysX is appropriate as an option for Windows if the supporting DLL's are available. Modified BulletX should be fine for Windows and Linux (not the original BulletX).
+
== ODE Plugin ==
 +
'''In Linux you should consider using included shell script, <tt>opensim-ode.sh</tt> or type <tt>ulimit -s 262144</tt> before running mono OpenSim.exe if you plan on having a large number of physics objects (each avatar is a physics object, as well as those which have the physics flag set on the simulator). The ulimit -s 262144 in Linux protects you against stack collisions and corrupted memory when there are a large amount of physical objects roaming around.'''
  
As of 10/9/07, ODE has received the bulk of testing. It supports basic collision with box-shaped primitives as well as box prims with box-shaped hollows.  Bullet supports box-shaped prims and appears stable; there has been little testing yet, and it is known to have issues with friction (you skate around on non-level surfaces).  Physx has not been updated in quite a while.
+
Currently, the ODE Plugin suports collisions Av2Av, Av2Prim and Prim2Prim. Avies and (active)physical prim movement supported.  
  
== Compiling ODE from source (Linux) ==
+
The currently collision behavior is:
If you want to compile the OpenDynamicsEngine (ODE) by yourself, get the latest OpenSim libraries source code (Ver. 0.9 as of Oct '07) from the SVN: http://opensimulator.org/svn/opensim-libs
+
* For avies, a capsule of .2m of radius and a length based on the avatar height and 80Kg of mass
Switch to the ode directory and compile it as follows:
+
* For prims, like a Box or Sphere with a mass of a Box of = 0.5Kg/l = 0.5Kg/dm3 = 500Kg/m3.
  
./configure --enable-shared
+
* Prim are separated into ~30m space islands with their own bounding box to speed 'near' calculation.
make -k
+
  
(I used to suggest --with-trimesh=gimpact, but no longer.  As of ODE 0.9, Opcode is the preferred and best-supported collision library)
+
* friction is reduced on avatar to object/ground collisions when the avatar is moving
  
This should create a <tt>libode.a</tt> and <tt>lidode.so</tt> file in the <tt>src/ode</tt> subdirectoryCopy these two files to the opensim <tt>bin</tt> directory (after having backed up the original files there). [er, I don't think the .a file is necessary to put in bin!]
+
=== To-do list (next changes) ===
 +
* This plugin is not currently under active developmentHowever, patches which implement extra functionality without any danger of regressions are still welcome.
  
== Compiling ODE from source (Windows) ==
+
=== Known bugs ===
 +
* Vehicle support is incomplete.
  
the standard distribution from ode.org has a build directory, in which you will find subdirs for several Microsoft compilers. 
+
=== Recent changes ===
  
The standard .sln files (at least for VS2005) compile ode.dll such that it depends on at least two Microsoft runtime dll's. This can cause failure and confusion, so do the following:
+
=== Compiling from source ===
 +
 
 +
OpenSimulator currently bundles r1755 of ODE (a revision post 0.11.1). The code is in the [[Opensim-libs git repository]], in the trunk/unmanaged/OpenDynamicsEngine-r1755/ directory. This directory has a few patches applied to ODE specifically for OpenSimulator ("git log" to see information about these). It also has instructions on how to build the code and install for OpenSimulator.
 +
 
 +
==== Old compile instructions ====
 +
 
 +
(Kept for now for comparison and historical purposes).
 +
 
 +
===== Linux =====
 +
 
 +
Ensure that the file ../ou/bootstrap is executable and then bootstrap the build process as follows:
 +
 
 +
It might be necessary to make the bootstrap file executable(if it is not) with this optional next step:
 +
 
 +
$ cd ou
 +
$ chmod +x bootstrap
 +
 
 +
Now get ready and run autogen
 +
 
 +
$ sh autogen.sh
 +
 
 +
and compile it as shown below. Depending on how permissions are setup, you may need to sudo for the make install step:
 +
 
 +
./configure --enable-shared --disable-demos --disable-asserts
 +
make
 +
make install
 +
cp /usr/local/lib/libode.so /my/opensim/production/dir
 +
 
 +
If you run into issues after doing this try the debug library by using the following line;
 +
 
 +
./configure --enable-shared --disable-demos
 +
 
 +
(I used to suggest --with-trimesh=gimpact, but no longer. As of ODE 0.9, Opcode is the preferred and best-supported collision library)
 +
 
 +
This should create a <tt>libode.a</tt> and <tt>lidode.so</tt> file in the <tt>src/ode</tt> subdirectory. Copy these two files to the opensim <tt>bin</tt> directory (after having backed up the original files there). [er, I don't think the .a file is necessary to put in bin!]
 +
 
 +
Try to play a bit with the avatar-settings in OpenSim.ini, if the avatar has it's feet stick in the terrain or if the basic-position is crouching.
 +
These settings seem to work on Linux64: (Note that these are old settings and may not work with the latest OpenSimulator versions)
 +
av_capsule_radius = 0.68
 +
av_capsule_standup_tensor_linux = 1900000
 +
av_density = 90
 +
 
 +
===== Mac OS X =====
 +
 
 +
You can use essentially the same build process on OS X as on Linux,
 +
but there are a couple of minor differences.
 +
 
 +
First, the <tt>autogen.sh</tt> script tries to automatically determine
 +
the name of the libtoolize binary (which is named glibtoolize on OS
 +
X). To do this, it uses the <tt>which</tt> command under bash, but
 +
the error code returned by <tt>which</tt> is always 0 in bash. If you
 +
see an error message like this:
 +
 
 +
autogen.sh: line 44: no: command not found
 +
 
 +
then open autogen.sh in a text editor and change the first
 +
<pre>LIBTOOLIZE=`which libtoolize`</pre> to <pre>LIBTOOLIZE=`which glibtoolize`</pre>
 +
and re-run it.
 +
 
 +
Also, you must have automake 1.10 or later. You can check your
 +
current version with:
 +
 
 +
automake --version
 +
 
 +
You can get version 1.10 from [http://www.macports.org/ MacPorts] or
 +
[http://www.finkproject.org/ fink] if yours is older. Be sure to
 +
place the new binary directories ahead of your system binary
 +
directories in your PATH. You may have to open a new shell for your
 +
changes to take effect.
 +
 
 +
Then you can follow the Linux instructions to build the library. When it has built, copy the <tt>ode/src/.libs/libode.dylib</tt> file to the OpenSimulator <tt>bin</tt> directory.
 +
 
 +
===== Windows =====
 +
 
 +
The standard distribution has a build directory, in which you will find subdirs for several Microsoft compilers.
 +
 
 +
The standard .sln files (at least for VS2005) compile ode.dll such that it depends on at least two Microsoft runtime dll's. This can cause failure and confusion, so do the following:
 
Right-click on ode in Solution Explorer, and select properties.
 
Right-click on ode in Solution Explorer, and select properties.
 
under Configuration Properties/General, change "Use of MFC" to read "Use MFC in a Static Library"
 
under Configuration Properties/General, change "Use of MFC" to read "Use MFC in a Static Library"
  
then compile as usual.
+
Under Configuration Properties/Linker/System. Change Stack Reserve Size to 262144000. Click the OK button then compile as usual.
  
== ODE Plugin in OpenSim ==
+
== POS Plugin ==
Currently, the ODE Plugin suports collisions Av2Av, Av2Prim and Prim2Prim. Avies and (active)physical prim movement supported.  
+
POS is Physics Of Simplicity. It is BasicPhysics with collisions.
  
The currently collision behavior is:
+
I took out my old wiki stuff because it was just plain wrong. The algorithm which is implemented in POS does ''not'' model the avatar as a sphere; rather, it models it as a rectilinear solid, same as the prims. However, collision detection is always done in the rotational frame of the prim, so depending on which prim you check against, the avatar is actually oriented differently.
* For avies, a capsule of .5m of radius and a length of .9m and 50Kg of mass
+
* For prims, like a Box with a mass of a Box of = 0.5Kg/l = 0.5Kg/dm3 = 500Kg/m3.
+
  
 
=== To-do list (next changes) ===
 
=== To-do list (next changes) ===
* Tune all collisions
+
* TODO
* Introduce Prim Shape Type to have more than the box shape using the Meshmerizer tri-mesh generator
+
* Fix bugs
+
* Implement ''grab and throw''
+
  
==== Known bugs ====
+
=== Known bugs ===
* Ground Collisions: ''Certain ground terrain causes avatar to bounce into the air without warning''
+
* TODO
* Mis-aligned Terrain: ''The visible terrain is slightly mis-aligned against the heightmap.  This causes the avatar to appear as if it's standing on empty space while slightly off of a hill and causes the avatar to appear as if it's knees are bent or feet in the terrain on the other side.''
+
 
* Making avatar taller causes knee bending.
+
== Old plugins ==
 +
 
 +
These are plugins that are no longer maintained and have been removed from OpenSimulator.
 +
 
 +
=== BulletX Plugin in OpenSim: Modified BulletX ===
 +
As of 2007 Bullet supported box-shaped prims and appears stable; there had been little testing, and it is known to have issues with friction (you skate around on non-level surfaces)
  
== BulletX Plugin in OpenSim: Modified BulletX ==
+
BulletX Plugin in OpenSimulator runs the modified version of BulletX. The original version of BulletX runs under and has code-dependencies with MS.XNA. The orginal BulletX can be found at [http://www.codeplex.com/xnadevru XNADev.ru]. The modified version removes all code dependencies with MS.XNA. On the other hand, it needs another library to work. This library is based on Mono.Xna and it's called MonoCompactMaths. The modified BulletX and the MonoXnaCompactMaths can be found on the svn of OpenSimulator. Because its code independency of MS.XNA, the modified BulletX should can be run under either MS.Net or Mono and, therefore, either Windows or Linux (obviously you can combine Windows + Mono)
BulletX Plugin in OpenSim runs the modified version of BulletX. The original version of BulletX runs under and has code-dependencies with MS.XNA. The orginal BulletX can be found at [http://www.codeplex.com/xnadevru XNADev.ru]. The modified version removes all code dependencies with MS.XNA. On the other hand, it needs another library to work. This library is based on Mono.Xna and it's called MonoCompactMaths. The modified BulletX and the MonoXnaCompactMaths can be found on the svn of OpenSim. Because its code independency of MS.XNA, the modified BulletX should can be run under either MS.Net or Mono and, therefore, either Windows or Linux (obviously you can combine Windows + Mono)
+
  
 
Currently, BulletX Plugin suports collisions Av2Av, Av2Prim and Prim2Prim. Prims and avies movement supported. By the way, collisions needs tunning. The currently collision's behavoir are:
 
Currently, BulletX Plugin suports collisions Av2Av, Av2Prim and Prim2Prim. Prims and avies movement supported. By the way, collisions needs tunning. The currently collision's behavoir are:
Line 57: Line 136:
 
* For prims, like a Box of the prim-size and a mass that it depends of its sizes. The mass it's the mass of Box of water with density = 1Kg/l = 1Kg/dm3 = 1000Kg/m3 (Be water my friend! :D).
 
* For prims, like a Box of the prim-size and a mass that it depends of its sizes. The mass it's the mass of Box of water with density = 1Kg/l = 1Kg/dm3 = 1000Kg/m3 (Be water my friend! :D).
  
=== To-do list (next changes) ===
+
==== To-do list (next changes) ====
 
* Tune collision
 
* Tune collision
 
* Introduce Prim Shape Type to have more than the box shape.
 
* Introduce Prim Shape Type to have more than the box shape.
 
* More than 1 region in a Sim and then more than 1 sim (grid)
 
* More than 1 region in a Sim and then more than 1 sim (grid)
 
* Fix bugs
 
* Fix bugs
 +
 
==== Known bugs ====
 
==== Known bugs ====
 
* Icy bug: ''an avatar acts like it is on ice and tends to drift off the edge of the sim after a while''
 
* Icy bug: ''an avatar acts like it is on ice and tends to drift off the edge of the sim after a while''
 
* Crash on BulletX. You will find the next message in console sometimes: ''Overflow in AABB, object removed from simulation If you can reproduce this, please email bugs@continuousphysics.com Please include above information, your Platform, version of OS. Thanks.''
 
* Crash on BulletX. You will find the next message in console sometimes: ''Overflow in AABB, object removed from simulation If you can reproduce this, please email bugs@continuousphysics.com Please include above information, your Platform, version of OS. Thanks.''
* <del>Rotation doesn't seem to work</del>
+
* <del>Rotation doesn't seem to work</del><br />
 
+
=== Physics Testing  Videos ===
+
 
+
ODE
+
http://www.nebadonizumi.com/vid/opensim/opensim_ODE_physics_test_01.mov
+
http://www.nebadonizumi.com/vid/opensim/opensim_ODE_physics_test_02.mov
+
  
BulletX
+
[[Category:Development]]
http://www.nebadonizumi.com/vid/opensim/opensim_BulletX_physics_test_01.mov
+
http://www.nebadonizumi.com/vid/opensim/opensim_BulletX_physics_test_02.mov
+

Latest revision as of 01:34, 18 November 2017

Contents

[edit] Introduction

Note: Much of this page was written in November 2009. The OpenDynamicsEngine OpenSimulator plugin is not currently under any significant active development as the BulletSim physics plugin will likely become the default in the next release of OpenSimulator. However, as of OpenSimulator 0.7.6, BulletSim is still considered experimental. -- Justincc 20:45, 19 November 2013 (UTC)

Note: BulletSim has become the default. Refer to the BulletSim pages for setup and operation -- Misterblue 17:54, 06 June 2014 (UTC)

The physics engines currently available for use in OpenSimulator are "basicphysics", "POS" and "OpenDynamicsEngine". As of OpenSimulator 0.6.9, the plugin "OpenDynamicsEngine" is the default and can be seen in the OpenSim.ini file.

ODE has received the bulk of testing. As of 2010 it supports collisions with all prims (cubes, spheres, cylinders etc) with any combination of distortions including hollow, taper, twist, path cut etc. In combination with Meshmerizer it also supports correctly colliding with sculpted prims.

[edit] ODE Plugin

In Linux you should consider using included shell script, opensim-ode.sh or type ulimit -s 262144 before running mono OpenSim.exe if you plan on having a large number of physics objects (each avatar is a physics object, as well as those which have the physics flag set on the simulator). The ulimit -s 262144 in Linux protects you against stack collisions and corrupted memory when there are a large amount of physical objects roaming around.

Currently, the ODE Plugin suports collisions Av2Av, Av2Prim and Prim2Prim. Avies and (active)physical prim movement supported.

The currently collision behavior is:

  • For avies, a capsule of .2m of radius and a length based on the avatar height and 80Kg of mass
  • For prims, like a Box or Sphere with a mass of a Box of = 0.5Kg/l = 0.5Kg/dm3 = 500Kg/m3.
  • Prim are separated into ~30m space islands with their own bounding box to speed 'near' calculation.
  • friction is reduced on avatar to object/ground collisions when the avatar is moving

[edit] To-do list (next changes)

  • This plugin is not currently under active development. However, patches which implement extra functionality without any danger of regressions are still welcome.

[edit] Known bugs

  • Vehicle support is incomplete.

[edit] Recent changes

[edit] Compiling from source

OpenSimulator currently bundles r1755 of ODE (a revision post 0.11.1). The code is in the Opensim-libs git repository, in the trunk/unmanaged/OpenDynamicsEngine-r1755/ directory. This directory has a few patches applied to ODE specifically for OpenSimulator ("git log" to see information about these). It also has instructions on how to build the code and install for OpenSimulator.

[edit] Old compile instructions

(Kept for now for comparison and historical purposes).

[edit] Linux

Ensure that the file ../ou/bootstrap is executable and then bootstrap the build process as follows:

It might be necessary to make the bootstrap file executable(if it is not) with this optional next step:

$ cd ou
$ chmod +x bootstrap

Now get ready and run autogen

$ sh autogen.sh

and compile it as shown below. Depending on how permissions are setup, you may need to sudo for the make install step:

./configure --enable-shared --disable-demos --disable-asserts
make
make install
cp /usr/local/lib/libode.so /my/opensim/production/dir

If you run into issues after doing this try the debug library by using the following line;

./configure --enable-shared --disable-demos

(I used to suggest --with-trimesh=gimpact, but no longer. As of ODE 0.9, Opcode is the preferred and best-supported collision library)

This should create a libode.a and lidode.so file in the src/ode subdirectory. Copy these two files to the opensim bin directory (after having backed up the original files there). [er, I don't think the .a file is necessary to put in bin!]

Try to play a bit with the avatar-settings in OpenSim.ini, if the avatar has it's feet stick in the terrain or if the basic-position is crouching. These settings seem to work on Linux64: (Note that these are old settings and may not work with the latest OpenSimulator versions)

av_capsule_radius = 0.68
av_capsule_standup_tensor_linux = 1900000
av_density = 90
[edit] Mac OS X

You can use essentially the same build process on OS X as on Linux, but there are a couple of minor differences.

First, the autogen.sh script tries to automatically determine the name of the libtoolize binary (which is named glibtoolize on OS X). To do this, it uses the which command under bash, but the error code returned by which is always 0 in bash. If you see an error message like this:

autogen.sh: line 44: no: command not found

then open autogen.sh in a text editor and change the first

LIBTOOLIZE=`which libtoolize`
to
LIBTOOLIZE=`which glibtoolize`

and re-run it.

Also, you must have automake 1.10 or later. You can check your current version with:

automake --version

You can get version 1.10 from MacPorts or fink if yours is older. Be sure to place the new binary directories ahead of your system binary directories in your PATH. You may have to open a new shell for your changes to take effect.

Then you can follow the Linux instructions to build the library. When it has built, copy the ode/src/.libs/libode.dylib file to the OpenSimulator bin directory.

[edit] Windows

The standard distribution has a build directory, in which you will find subdirs for several Microsoft compilers.

The standard .sln files (at least for VS2005) compile ode.dll such that it depends on at least two Microsoft runtime dll's. This can cause failure and confusion, so do the following: Right-click on ode in Solution Explorer, and select properties. under Configuration Properties/General, change "Use of MFC" to read "Use MFC in a Static Library"

Under Configuration Properties/Linker/System. Change Stack Reserve Size to 262144000. Click the OK button then compile as usual.

[edit] POS Plugin

POS is Physics Of Simplicity. It is BasicPhysics with collisions.

I took out my old wiki stuff because it was just plain wrong. The algorithm which is implemented in POS does not model the avatar as a sphere; rather, it models it as a rectilinear solid, same as the prims. However, collision detection is always done in the rotational frame of the prim, so depending on which prim you check against, the avatar is actually oriented differently.

[edit] To-do list (next changes)

  • TODO

[edit] Known bugs

  • TODO

[edit] Old plugins

These are plugins that are no longer maintained and have been removed from OpenSimulator.

[edit] BulletX Plugin in OpenSim: Modified BulletX

As of 2007 Bullet supported box-shaped prims and appears stable; there had been little testing, and it is known to have issues with friction (you skate around on non-level surfaces)

BulletX Plugin in OpenSimulator runs the modified version of BulletX. The original version of BulletX runs under and has code-dependencies with MS.XNA. The orginal BulletX can be found at XNADev.ru. The modified version removes all code dependencies with MS.XNA. On the other hand, it needs another library to work. This library is based on Mono.Xna and it's called MonoCompactMaths. The modified BulletX and the MonoXnaCompactMaths can be found on the svn of OpenSimulator. Because its code independency of MS.XNA, the modified BulletX should can be run under either MS.Net or Mono and, therefore, either Windows or Linux (obviously you can combine Windows + Mono)

Currently, BulletX Plugin suports collisions Av2Av, Av2Prim and Prim2Prim. Prims and avies movement supported. By the way, collisions needs tunning. The currently collision's behavoir are:

  • For avies, like and sphere of 1m of radious and 50Kg of mass
  • For prims, like a Box of the prim-size and a mass that it depends of its sizes. The mass it's the mass of Box of water with density = 1Kg/l = 1Kg/dm3 = 1000Kg/m3 (Be water my friend! :D).

[edit] To-do list (next changes)

  • Tune collision
  • Introduce Prim Shape Type to have more than the box shape.
  • More than 1 region in a Sim and then more than 1 sim (grid)
  • Fix bugs

[edit] Known bugs

  • Icy bug: an avatar acts like it is on ice and tends to drift off the edge of the sim after a while
  • Crash on BulletX. You will find the next message in console sometimes: Overflow in AABB, object removed from simulation If you can reproduce this, please email bugs@continuousphysics.com Please include above information, your Platform, version of OS. Thanks.
  • Rotation doesn't seem to work
Personal tools
General
About This Wiki