Humanoid Control for Unity v4
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Passer.Humanoid.AvatarManager Class Reference

Description

Manage avatar meshes for a humanoid.

The avatar manger can be used to manage multiple avatar meshes for a single humanoid. It is supported single player and networking setups.

Setup

The Avatar Manager script can be found should be attached to an GameObject with the HumanoidControl component script.

Single User

The Avatar Manger script shows the list of available avatars to use. Every avatar needs to have a Animator component attached and only avatars from the Project Window (prefabs, models) are supported, so you cannot use avatar in you scene. New avatars can be added to the list by clicking Add Avatar while empty slots will be cleaned up automatically. The Current Avatar Index shows the index number of the avatar which is currently used. At startup, this value will determine which avatar is used when the scene is started. Note: this will override the avatar which is attached to the HumanoidControl component!

Networking

When Networking Support is enabled additional entries for the third person avatar will be shown.

These values match the behaviour of the Remote Avatar in the Humanoid Control script: at the local client, the first person avatar is used, while the third person avatar is used on remote clients. This will enable you to optimize the avatars for each case. If the Third Person avatar is left to None, like for Robot Kyle in the example above, the First Person avatar will also be used for remote clients.

Changing Avatars

The avatar can be set using on of the scripting functions like PreviousAvastar, NextAvatar and SetAvatar. These functions can also be used in combination with Scripts or ControllerInput:

Inherits MonoBehaviour.

Public Member Functions

void NextAvatar ()
 Replaces the current avatar by the next avatar in the list.
 
void PreviousAvatar ()
 Replaces the current avatar by the previous avatar in the list.
 
void SetAvatar (int avatarIndex)
 This will replace the current avatar with the avatar indicated by the avatarIndex.
 

Static Public Member Functions

static int mod (int k, int n)
 

Public Attributes

int currentAvatarIndex = 0
 The index of the current avatar in the list.
 
Animator[] fpAvatars = new Animator[0]
 The list of avatars for the humanoid.
 
Animator[] tpAvatars = new Animator[0]
 The list of third person avatar for networked humanoids.
 

Protected Member Functions

virtual void Start ()
 

Protected Attributes

HumanoidControl humanoid
 

Member Function Documentation

◆ NextAvatar()

void Passer.Humanoid.AvatarManager.NextAvatar ( )

Replaces the current avatar by the next avatar in the list.

This will wrap around when the last avatar is the current avatar.

◆ PreviousAvatar()

void Passer.Humanoid.AvatarManager.PreviousAvatar ( )

Replaces the current avatar by the previous avatar in the list.

This will wrap around when the first avatar is the current avatar.

◆ SetAvatar()

void Passer.Humanoid.AvatarManager.SetAvatar ( int  avatarIndex)

This will replace the current avatar with the avatar indicated by the avatarIndex.

Parameters
avatarIndexThe index of the avatar in the list of avatars

Member Data Documentation

◆ fpAvatars

Animator [] Passer.Humanoid.AvatarManager.fpAvatars = new Animator[0]

The list of avatars for the humanoid.

For networked avatars this avatar will be used for the local client.

◆ tpAvatars

Animator [] Passer.Humanoid.AvatarManager.tpAvatars = new Animator[0]

The list of third person avatar for networked humanoids.

This is the avatar which will be used to show a player of remote clients. When no third person avatar is specified, the first person avatar will be used as the third person avatar.


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