AvatarActor

AvatarActor

AvatarActor implements the model-side features of the avatar.

Members

# lookPitch :number

The avatar's camera rotation around the X axis (the axis going from left to right; thus a positive value indicates to look "up" ,and a negative value indicates to look "down".)

To get desired effects, use the set method:

`this.set({lookPitch: n})

Typically you would set lookPitch and lookYaw at the same time:

this.set({lookPitch: m, lookYaw: n})

Type:
  • number

# lookYaw :number

The avatar's camera rotation around the Y axis in the scene (the axis going from bottom to top; thus a positive value indicates to look east, and a negative value indicates to look west.

To get desired effects, use the set() method:

this.set({lookYaw: n})

Typically you would set lookPitch and lookYaw at the same time:

this.set({lookPitch: m, lookYaw: n})

Type:
  • number

# lookOffset :Vector3

The offset in 3D coordinates between avatar's position and the camera's position. A typical third person view behind the avatar has [0, p, p], where p is a positive number.

While those three variables are used in the default walkLook() implementation, you can override the method to have a totally custom camera position. (see below.)

Type:
  • Vector3

Methods

# goTo(v, q, fall)

Glide to the specified position and rotation in the global coordinate. The fall flag specifies whether the avatar should start falling to the ground or not.

Parameters:
Name Type Description
v Vector3

the translation to go to.

q Quaternion

the rotation to go to.

fall boolean

a flag to specify whether the avatar should start falling immediately

# goHome()

Equivalent to call:

goTo([0, 0, 0], [0, 0, 0, 1]);
this.set({lookPitch: 0, lookYaw: 0});
this.say("setLookAngles", {pitch: 0, yaw: 0, lookOffset: [0, 0, 0]});

the last say line notifies the pawn to update the display.

# dropPose(distance, optOffsetnullable)

This method computes the position and rotation in front of the avatar at specified distance. The optional optOffset is added to the result in the reference frame of the avatar.

The function returns an object with two properties {translation: Vector3, rotation: Quaternion}.

Parameters:
Name Type Attributes Description
distance Vector3

the distance from the avatar's position

optOffset Vector3 <nullable>

additional offset from the position computed above

Returns:

Pose

# translateTo(v)

This method sets the translation of the avatar to the specified [x, y, z] coordinates. (Inherited from CardActor.)

Parameters:
Name Type Description
v Vector3

the new translation of the avatar.

# rotateTo(q)

This method sets the rotation of the avatar to the specified quaternion. (Inherited from CardActor.)

Parameters:
Name Type Description
q Quaternion

the new rotation of the avatar.

# scaleTo(s)

This method sets the scale of the avatar to the specified by scale factors in [x, y, z] axis. (Inherited from CardActor.)

Parameters:
Name Type Description
s Vector3

the new scale of the avatar.