A skeleton consists of a hierarchy of joints. Each joint defines a coordinate space.
Portions of a model may be thought of as having a position in a joint's local space.
Each joint in a skeleton has a name, which usually determines the joint's parent. For
example, the legs of a human body might include these joints:
- `root`
- `root/hips_joint`
- `root/hips_joint/left_upLeg_joint`
- `root/hips_joint/left_upLeg_joint/left_leg_joint`
- `root/hips_joint/right_upLeg_joint`
- `root/hips_joint/right_upLeg_joint/right_leg_joint`
- etc.
Models with skinned animation are authored in a fixed pose (the "bind pose"). The position
of a vertex in a particular joint's local space is a function of the vertex's position in
the bind pose and an "inverse bind pose" matrix which transforms from the bind pose (model
space) to the joint's local space.
When unanimated, the pose of a skinned model is defined by the rest pose of each joint. This
transform is relative to the joint's parent. Usually, the rest pose of a model is the same
as its bind pose.
Creates a skeleton from arrays which define its joints. Returns `nil` if there was an
issue converting the parameters to a valid skeleton.
- Parameters:
- id: The unique name of this skeleton.
- jointNames: The names of each joint.
- inverseBindPoseMatrices: The matrix which, for each joint, transforms from model
space (bind pose) to the local space of that joint.
- restPoseTransforms: The transform from each joint's local space to its parent's local
space, used when the joint is not animated. If not specified, the rest pose is assumed to
be the same as the bind pose, and is computed from the inverse bind pose matrices.
- parentIndices: The index of each joint's parent, or nil if that joint has no parent.
If this array is not provided, the parent of each joint is inferred from its name (e.g.
a joint named `root/hips_joint` is parented to a joint named `root`).
- Note: A parent joint needs to precede all of its child joints.
- Note: All the arrays passed to this initializer need to have the same length.
Creates a skeleton from an array of joints.
- Important: The order of joints in this array is significant;
parents need to precede their children.
get · iOS 18.0+
id
TypeScript
get id(): Promise<string>
Swift declaration
var id: String
The unique identifier of this skeleton. This acts as a stable identity for this object.
set · iOS 18.0+
id
TypeScript
setId(value: string): Promise<void>
Swift declaration
var id: String
The unique identifier of this skeleton. This acts as a stable identity for this object.
get · iOS 18.0+
joints
TypeScript
get joints(): Promise<Array<MeshResource_Skeleton_Joint>>
Swift declaration
var joints: [MeshResource.Skeleton.Joint]
The joints which define this skeleton's hierarchy.
- Important: The order of joints in this array is significant;
parents need to precede their children.
The joints which define this skeleton's hierarchy.
- Important: The order of joints in this array is significant;
parents need to precede their children.