Constructor
# new OCOLimb(limbopt, sideopt, locationopt, typeopt)
Creates a new OCO Limb.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
limb |
OCO.Limb
|
<optional> |
OCO.Limb.CUSTOM | A Predefined limb |
side |
OCO.Side
|
<optional> |
OCO.Side.NONE | The side of the limb |
location |
OCO.Location
|
<optional> |
OCO.Location.NONE | The location of the limb |
type |
OCO.LimbType
|
<optional> |
OCO.LimbType.CUSTOM | The type of the limb |
Members
Methods
# static fromObject(data) → {OCOLimb}
Creates a limb from a js object.
Parameters:
Name | Type | Description |
---|---|---|
data |
Object
|
The js object representing the limb |
The new limb
# bounds() → {Array.<float>}
Gets the boundaries of the limb
[left, top, right, bottom]
Array.<float>
# getBones() → {Array.<OCOBone>}
Gets all the bones sorted by z index
The list of bones
Array.<OCOBone>
# getLimbs() → {Array.<OCOLimb>}
Recursively gets all the children limbs of this limb
The array of all limbs
Array.<OCOLimb>
# newArmature(name, numopt, lengthopt) → {OCOBone}
Creates a new chain of bones and adds it to the limb.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
name |
string
|
The name of the bones (will increment if needed) | ||
num |
int
|
<optional> |
2 | The number of bones in the chain |
length |
float
|
<optional> |
100.0 | The length in centimeters |
The root bone.
# normalizeZIndices(offsetopt) → {int}
Normalizes the Z indices of all bones so they're positive (including 0) and continuous integers
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
offset |
int
|
<optional> |
0 | An offset/start number |
The highest index
int
# toObject() → {Object}
Creates a js object containing this limb data.
This object could then be exported to JSON for example.
This object could then be exported to JSON for example.
The JS Object
Object
# zBounds() → {Array.<int>}
Finds the maximum and minimum Z index from all bones
The [min, max] Z indices
Array.<int>