Physics with joints

<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/bObSTwQTUKE&hl=fr&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/bObSTwQTUKE&hl=fr&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>

Here's a quick start guide.

To see the existing demos:

  • apply the patch in the patches directory to your OpenSim source tree
  • compile
  • cd to the bin directory
  • Copy either demo-ragdoll.db or demo-car.db to opensim.db
  • Run opensim.exe (opensim.ini is configured for standalone mode with ODE physics)
  • Connect your viewer to http://localhost:9000, login as test user (test)
  • Select all prims in the region except the red box.
  • Press ENTER to open the chat dialog. The prims must remain selected.
  • Type “go” into chat. The script in the red box sends the selected prims and joints to the physics engine.
  • Click on the jointed assembly and drag it around. Clicking on the ragdoll's head will make the ragdoll float up for a few seconds.

Known bugs:

  • Joints are not persisted, nor can they cross regions.
  • The joint objects remain in the scene after physics conversion, so you need to drag the jointed assembly away from its original position to allow it to freely move.
  • The jointed parts can drift slightly apart on the viewer, because the viewer (currently) has no local representation of the joints.
  • Joints cannot be edited or deleted after the “go” command has been issued.

To make your own bodies connected with a ball joint:

  • Create two box prims side-by-side with space in between them. Leave them non-physical for now. Give each one a unique name (right click, edit, General tab, Name). Example names are “box1” and “box2”. Leave the dimensions at (0.5, 0.5, 0.5). These 2 prims will be connected by a ball joint.
  • Create a small sphere. Make its dimensions something like (0.1, 0.1, 0.1). This prim represents a ball-and-socket joint. Position the sphere between the 2 boxes. Assign the small sphere the name of “balljoint”. Give the sphere a Description of “box1 box2”, which are the names of the 2 prims to be connected, separated by a space.
  • Create a scripted prim to create all the physics bodies and joints simultaneously. Do this as follows. Create a box somewhere on the ground, away from the other prims. Give it a red color to distinguish it from the other prims. Create a new script in the prim's inventory and edit it with the following contents. Save the script and wait for the “script running” message.
default
{
  state_entry()
  {
    llSay(0, "Script running");
    llListen(0,"","","");
  }
  listen(integer channel, string name, key id, string msg)
  {
    if(msg=="go")
    {
      osCreatePhysicsFromSelection();
    }
  }
}
  • Close all windows in the viewer. Press Ctrl+3 to enter edit mode. Drag the mouse to highlight the 2 boxes to be connected and the small sphere.
  • Press ENTER to open the chat window, while keeping the objects selected. In the “Local chat” text field, type “go” and press enter. This creates physics bodies and joints from the selected objects. Press ESC to exit editing mode. The boxes are now physical and connected by a ball-and-socket joint.
  • Drag the boxes around and notice they remain connected by an invisible joint. The original joint object remains in its original position (bug).

A similar procedure is used for creating bodies connected with hinge joints, with the following differces:

  • The joint object should be named “hingejoint”.
  • The joint object's position determines the anchor of the hinge.
  • The joint object's X axis orientation determines the axis of rotation of the hinge. The easiest way to visualize this is to create a prim whose size is elongated along its x axis; set the object size directly in the object editor to something like (1.0, 0.1, 0.1).

Hinges can be used for simulating wheels. Hinge stops currently cannot be specified so the bodies can rotate freely around the hinge, like a wheel around an axle.

TODO:

A million things, but the most important is designing a way to cleanly specify, edit, and persist joints, using only the facilities that a standard viewer offers us. After that:

  • proper joint accounting: ensure joints never get lost when bodies are deleted, resized, cross regions, etc.
  • other joint types
  • specification of joint parameters
  • OSSL script API for complete access to all joint information
  • region crossing of jointed assemblies

Source http://forge.opensimulator.org/gf/project/physicsjoints/

 
Connecté en tant que : Guest (Guest)
home/personnaliser/physics-with-joints.txt · Dernière modification: 2008/11/23 21:32 par Green Tamura
 

Espace Membre

Les nouveautés

Forum

Ordre: Nouveau Affichés Contributions
Dernières Contributions Postées
red arrowOpenSim - Server dé..
 Par :  ECH
 Le  10 septembre 2010 - 06:34
 Affichés 1139 Réponses 27
red arrowOPENSIM STANDALONE s..
 Par :  ECH
 Le  04 septembre 2010 - 04:38
 Affichés 198 Réponses 1
red arrowinstallation et hebe..
 Par :  XAV10
 Le  09 juillet 2010 - 05:13
 Affichés 621 Réponses 2
red arrowChanger la couleur d..
 Par :  ECH
 Le  03 juillet 2010 - 17:26
 Affichés 598 Réponses 3
red arrowinstalation opensim ..
 Par :  virtualfrance
 Le  02 juillet 2010 - 10:21
 Affichés 245 Réponses 1
red arrowImporter des modèle..
 Par :  Crabe05
 Le  01 juillet 2010 - 21:59
 Affichés 393 Réponses 4
red arrowProblème d'installa..
 Par :  Razgriz
 Le  01 juillet 2010 - 12:56
 Affichés 353 Réponses 11
red arrowErreur lancement Hip..
 Par :  TheShock
 Le  22 juin 2010 - 17:18
 Affichés 368 Réponses 2
red arrowChanger l'heure
 Par :  jeannot
 Le  09 juin 2010 - 14:14
 Affichés 324 Réponses 0
red arrowBug opensim 0.6.9 rc..
 Par :  ECH
 Le  20 mai 2010 - 08:11
 Affichés 728 Réponses 5

Who's Online

Visiteurs: 6