Bone Object Agents

 

Bone objects are considered children of Mesh objects; Bones cannot exist by themselves. As such, access to Bone information must take place through the parent Mesh object. Bone objects essentially become data members of the LScript Mesh object.

mesh = Mesh();// Create a Mesh Object.

bone = mesh.bone(); // Create a Bone Object from

                              // the parent Mesh Object.

Note: Remember that not all of the common Data Members and Methods apply to Bone Objects.


Data Members

restlength
restlength contains a floating-point number that represents the rest length of the Bone in meters.

innerlimit
innerlimit contains a floating-point number that represents the inner limit radius of the Bone (valid only if flags[2] is 'true').

outerlimit
outerlimit contains a floating-point number that represents the outer limit radius of the Bone (valid only if flags[2] is 'true').

flags[]
flags[] holds an array of two boolean values that represent the Bone's current options:

[1] == true if Bone is active, or false if not.

[2] == true if Bone is limited, or false if unlimited.

Methods

restparam(state)
restparam(state) returns an array of three numbers that represent the value of a particular Bone state. The state value can be one of POSITION, RIGHT, UP, FORWARD, ROTATION, SCALING, PIVOT, WPOSITION, WRIGHT, WUP, and WFORWARD constants.

Examples:
This example, given an object and bones in an object, will cycle through the bones and display some of their information.

@version 2.2
@warnings
@name boneObjectAgentTest
@script generic

generic
{
    // set the frame variable for frame: 0
    currTime = 0;

     // Create Mesh Object Agent from first object.
    mesh = Mesh();

     // Create Bone Object Agent from first bone in
    // from mesh Object Agent.

     bone = mesh.bone();

// Cycle through all bones until a bone value == 'nil'.while(bone)
    {
    // Display some of the current bone’s
    // values on frame 0, by accessing bone Object Agent.
    info("Bone Name: ", bone);

          // default attribute.
         info("Bone Position: ", bone.getPosition(currTime));
         info("Bone Rotation: ", bone.getRotation(currTime));

         // Cycle to next bone. If no bone is available, bone // will equal ‘nil’.
        bone = bone.next();
        
}
}

Layout Commands

AddBone("name");
AddChildBone("name");
BoneActive();
BoneFalloffType("type");
BoneJointComp();
BoneJointCompAmounts("self","parent");
BoneJointCompParent();
BoneLimitedRange();
BoneMaxRange("distance");
BoneMinRange("distance");
BoneMuscleFlex();
BoneMuscleFlexAmounts("self","parent");
BoneMuscleFlexParent();
BoneNormalization();
BoneRestLength("length");
BoneRestPosition("X","Y","Z");
BoneRestRotation("H","P","B");
BoneSource("ID");
BoneStrength("strength");
BoneStrengthMultiply();
BoneWeightMapName("name");
BoneWeightMapOnly();
BoneWeightShade();
BoneXRay();
ClearAllBones();
DrawBones();
DrawChildBones();
FasterBones();
RecordRestPosition();
RestLengthTool();
EditBones();
SelectAllBones();
SkelegonsToBones();
UseMorphedPositions();