From Second Life Wiki
Jump to: navigation, search

Joints are an obsolete technology that are no longer a part of the Second Life experience.

Work on reimplementing joints is not likely to occur until after the main grid has been fully upgraded to the new Havok 4 engine.

Definition of a Joint

A joint is a free-moving rotational axis formed between two primitives, and is a function of the phyics engine. The two basic joint types are:

  • Hinge Joint, with rotation constrained along a single axis
  • Point-to-Point, allowing free rotation in any direction on the three different axis

 ! Constraining an object on two axis does not work, because it is possible to move through the third axis through special compounded rotations of just two axis.

Reason for Removal

An screenshot showing how joints can misbehave.

Joints suffered from a number of serious internal bugs, which would result in objects shooting apart across the simulator at high speed, if the "wrong" object was edited. When jointed, only the parent object could be moved and the child would immediately jump to align on the new location with the parent. In certain conditions edited joints would seem to disappear, but were in fact suddenly moving to coordinates <0,0,0> and out of editing range of the avatar.

Joints were a component of the original Havok I physics engine but were implemented in a manner that resulted in a mess of sphagetti programming code that was extremely difficult to manage. For a long time joints were one of the primary obstacles in the path of upgrading the Havok engine. A decision had to be made to remove them to ease the upgrade process.

Scripting Alternatives

In certain constrained conditions it is still possible to do what was possible with hinge joints but instead through LSL scripting. While joints allowed an object to be constrained along an arbitrary angle of rotation, this method allows constraining only along the three cardinal axis of X, Y, and Z.

1. Place object in world where it is desired to freely rotate, but do not set physical.

2. Create a new script in the object and edit it to look like this:

<lsl>default {

       vector here;
       here = llGetPos();
       llSetStatus(STATUS_PHYSICS, TRUE);
       llSetStatus(STATUS_ROTATE_X, FALSE);
       llSetStatus(STATUS_ROTATE_Y, FALSE);
       llSetStatus(STATUS_ROTATE_Z, TRUE);


3. When the script saves, it will auto-activate and do the following:

It finds the current location of the object, uses llMoveToTarget() to tell the physics engine to make the object hover in midair at that location, and sets the object to be physical.

It then constrains rotation on the X and Y axis, permitting only rotation around the Z axis.

By using a timer and llPushObject, the object can be made to spin continously in midair without the use of joints.