GetAvatarBoneTransform
Method
Get the transform of a bone in the avatar's body.
Definition
Transform GetAvatarBoneTransform(HumanBodyBones humanBone)
Transform GetAvatarBoneTransform(HumanBodyBones humanBone)
Returns Transform
Parameters
Parameter | Description |
---|---|
HumanBodyBones humanBone |
Examples
private Transform chestBoneTransform;
void Awake()
{
// Check to make sure the avatar is loaded before getting the bone
if (SpatialBridge.actorService.localActor.avatar.isBodyLoaded)
{
SetChestBoneTransform();
}
// Spatial allows users to change their avatars, which can cause the initial transform
// to be destroyed. We have to set it again once new avatar is loaded
SpatialBridge.actorService.localActor.avatar.onAvatarLoadComplete += SetChestBoneTransform;
}
void SetChestBoneTransform()
{
chestBoneTransform = SpatialBridge.actorService.localActor.avatar.GetAvatarBoneTransform(HumanBodyBones.Chest);
}
private Transform chestBoneTransform;
void Awake()
{
// Check to make sure the avatar is loaded before getting the bone
if (SpatialBridge.actorService.localActor.avatar.isBodyLoaded)
{
SetChestBoneTransform();
}
// Spatial allows users to change their avatars, which can cause the initial transform
// to be destroyed. We have to set it again once new avatar is loaded
SpatialBridge.actorService.localActor.avatar.onAvatarLoadComplete += SetChestBoneTransform;
}
void SetChestBoneTransform()
{
chestBoneTransform = SpatialBridge.actorService.localActor.avatar.GetAvatarBoneTransform(HumanBodyBones.Chest);
}