Class: AvatarController

AvatarController()

This is control for user's avatar, both local and remote: propagates local avatar events to the network, and acts as remote controller for all remote instances. Installed as change listener to WorldManager, tracks position of all events that user sends - typically movement - and optinally adds some more - typically avatar animations. E.g. when position changes, it sends 'walk' animation, if current avatar has animation named 'walk'. User stops, it sends 'idle' animation, if current avatar has animation named 'idle', so all other users see this avatar moving and idling. Provides methods to switch between 1st and 3rd person view, and manages movement of own avatar. Use World.firstPersonCamera() and World.thirdPersonCamera() to ensure equal movement speeds.

Constructor

new AvatarController()

Source:

Classes

AvatarController

Members

idleTimeout

After not receiving any events for this many millis, idle animation starts
Source:

lastChange

Timestamp of last change
Source:

Methods

addDirection()

Internal: add movement direction
Source:

dispose()

Cleanup, CHECKME
Source:

firstPerson()

Performs coordinate transformation and other bookkeeping required to switch from 3rd to 1st person camera.
Source:

handleClick()

Default pointer handler, calls moveToTarget on LMB click
Source:

handleKeyboard()

Default keyboard handler, WASD keys for movement
Source:

processChanges(changes)

Process locally generated changes to avatar. Called from WorldManager.trackChanges(). Position changes also change idle animation timer, and wrote event may trigger appropriate animation.
Parameters:
Name Type Description
changes array of field,value object pairs
Source:

sendAnimation(animation, loop)

Send an animation to the server, if the avatar has it.
Parameters:
Name Type Default Description
animation AnimationGroup to activate remotely
loop false default false
Source:

setupIdleTimer()

Create timer for idle animation, if it doesn't exist.
Source:

thirdPerson()

Performs coordinate transformation and other bookkeeping required to switch from 1st to 3rd person camera.
Source: