EGDL2 2.1
Loading...
Searching...
No Matches
Enablegames.AvatarSkeleton Class Reference

Represents the skeleton of an avatar. Contains functions to map the information from one avatar to the another base on T pose. More...

Inherits MonoBehaviour.

Collaboration diagram for Enablegames.AvatarSkeleton:

Classes

class  BoneInfo
 Represents information about a bone. More...
 

Public Member Functions

virtual void Awake ()
 Use this for initialization.
 
string boneIndex2Name (int boneIndex)
 Converts a bone index to its corresponding name in the Mecanim humanoid model.
 
Transform boneIndex2Transform (int boneIndex)
 Retrieves the Transform of a bone based on its index.
 
int boneIndexCount ()
 Returns the number of bone indexes in the AvatarSkeleton.
 
EnableBody GetSkeletonData (bool global)
 Gets avatar's joint positions and orientations relative to initial T-Pose. Needs to cache ebody so only calculated if needed.
 
void SetFromBody (EnableBody body, float duration, float speed=1.0f, bool usePositionData=false, bool mirror=false)
 Sets the Avatar's joints using EnableBody as relative-to-Tpose rotation data.
 

Static Public Member Functions

static void GetAvatarSkeleton (GameObject mygameObject, ref AvatarSkeleton avatarSkeleton)
 Retrieves an instance of the AvatarSkeleton component attached to the given GameObject or adds the component if it is not found.
 

Public Attributes

bool globalData = true
 Boolean indicates whether using global data in the AvatarSkeleton class.
 
Animator animatorComponent
 The animator component attached to the AvatarSkeleton.
 
GameObject offsetNode
 Avatar's offset/parent object that may be used to rotate and position the model in space.
 
BoneControllerInterface boneControllerInterface
 Represents the interface for controlling bone operations in the AvatarSkeleton class.
 

Static Public Attributes

static readonly Dictionary< int, HumanBodyBones > boneIndex2MecanimMap
 Dictionary for looking up which avatar bones we are interested in. For now, we are only interested in the ones that kinect provides.
 

Protected Member Functions

virtual void MapBones ()
 If the bones to be mapped have been declared, map that bone to the model.
 
void GetInitialRotations ()
 Capture the initial rotations of the bones.
 

Protected Attributes

Transform[] bones
 Variable to hold all them bones. It will initialize the same size as initialRotations.
 
Quaternion[] initialRotations
 Rotations of the bones when in T-Pose.
 
Vector3 initialPosition
 Initial position and rotation of the body.
 

Detailed Description

Represents the skeleton of an avatar. Contains functions to map the information from one avatar to the another base on T pose.

Member Function Documentation

◆ boneIndex2Name()

string Enablegames.AvatarSkeleton.boneIndex2Name ( int boneIndex)
inline

Converts a bone index to its corresponding name in the Mecanim humanoid model.

Parameters
boneIndexThe index of the bone.
Returns
The name of the bone.

◆ boneIndex2Transform()

Transform Enablegames.AvatarSkeleton.boneIndex2Transform ( int boneIndex)
inline

Retrieves the Transform of a bone based on its index.

Parameters
boneIndexThe index of the bone.
Returns
The Transform of the bone.

◆ boneIndexCount()

int Enablegames.AvatarSkeleton.boneIndexCount ( )
inline

Returns the number of bone indexes in the AvatarSkeleton.

Returns
The count of bone indexes in the AvatarSkeleton.

◆ GetAvatarSkeleton()

static void Enablegames.AvatarSkeleton.GetAvatarSkeleton ( GameObject mygameObject,
ref AvatarSkeleton avatarSkeleton )
inlinestatic

Retrieves an instance of the AvatarSkeleton component attached to the given GameObject or adds the component if it is not found.

Parameters
mygameObjectThe GameObject to search for the AvatarSkeleton component.
avatarSkeletonA reference to the AvatarSkeleton component.
Here is the call graph for this function:

◆ GetSkeletonData()

EnableBody Enablegames.AvatarSkeleton.GetSkeletonData ( bool global)
inline

Gets avatar's joint positions and orientations relative to initial T-Pose. Needs to cache ebody so only calculated if needed.

Parameters
globalOnly global is currently supported
Returns
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetFromBody()

void Enablegames.AvatarSkeleton.SetFromBody ( EnableBody body,
float duration,
float speed = 1::0f,
bool usePositionData = false,
bool mirror = false )
inline

Sets the Avatar's joints using EnableBody as relative-to-Tpose rotation data.

Parameters
bodyT-pose offset rotation data
durationHow quickly to get to final pose
speedMultiplier to duration
usePositionDataWhether to use or ignore joint positions (and only use orientations)

The documentation for this class was generated from the following file: