HostPointOfInterest

HostPointOfInterest

Class to handle a Host's Point of Interest

Constructor

new HostPointOfInterest(pointOfInterestConfig, pointOfInterestType, hostComponentEntity, hostEntity, targetEntityopt)

setup Point of Interest object

Parameters:
Name Type Attributes Description
pointOfInterestConfig Object

Object with config options, as follows:

Properties
Name Type Attributes Description
leftEyeName string <optional>

Name of the left eye joint in the rig

rightEyeName string <optional>

Name of the right eye joint in the rig

neckAName string <optional>

Name of the base neck joint in the rig

neckBName string <optional>

Name of the end neck joint (head) in the rig

eyelidRegEx string <optional>

Regular expression that will find the eyelid joints

browRegEx string <optional>

Regular expression that will find joints used in eyebrow movement

lookAnim_u string <optional>

Animation pose with character looking up the maximum amount

lookAnim_ur string <optional>

Animation pose with character looking up and right the maximum amount

lookAnim_r string <optional>

Animation pose with character looking right the maximum amount

lookAnim_dr string <optional>

Animation pose with character looking down and right the maximum amount

lookAnim_d string <optional>

Animation pose with character looking down the maximum amount

lookAnim_dl string <optional>

Animation pose with character looking down and left the maximum amount

lookAnim_l string <optional>

Animation pose with character looking left the maximum amount

lookAnim_ul string <optional>

Animation pose with character looking up and left the maximum amount

headRotateSpeed string <optional>

head rotation speed

eyeRotateSpeed string <optional>

eye rotation speed

browSpeed string <optional>

brow animation reaction speed

pointOfInterestType string

'None' || 'LookAtEntity'

hostComponentEntity Entity

The Entity with the Host Component

hostEntity Entity

The child Host Entity (with mesh, animation, etc)

targetEntity Entity <optional>

The LookAt Target Entity

Methods

_findParentEntityForSkeletonPose(rootSearchEntity, skeletonPose) → {Entity}

Returns the first (top-most) entity with a child entity whose first MeshDataComponent matches the given
skeletonPose. This is a recursive function

Parameters:
Name Type Description
rootSearchEntity Entity

entity whose children will be searched

skeletonPose SkeletonPose

skeleton pose to check for matches

createManagedLayer(clipopt, nameopt, jointsopt) → {AnimationLayer}

Create and return an additive layer with ManagedTransforms

Parameters:
Name Type Attributes Description
clip AnimationClip <optional>

clip to use for layer initialization

name string <optional>

name for the new layer

joints array.<string> <optional>

names of joints to add to the layer

entityDetached()

Called when the HostComponent is removed from an entity - do clean-up/tear-down work

findJoints(skeleton, regex) → {Array.<Joint>}

Finds the Joints in a Skeleton whose names match the regular expression

Parameters:
Name Type Description
skeleton Skeleton

asset to search

regex RegExp

regular expression to match

getBlend2DLookDirection(coord) → {String|null}

get the look direction name based on the given 2D (horizontal, vertical) coordinate

Parameters:
Name Type Description
coord Vector2

2D coord to lookup blend look direction name with

interpolateLookLayerJoint(jointNameopt, blendDataopt, speedopt)

Interpolate a joint in the look layer from its current pose

Parameters:
Name Type Attributes Description
jointName string <optional>

name of the joint

blendData JointData <optional>

data to interpolate towards

speed float <optional>

speed multiplier for the interpolation

process()

Called on every frame - this is what does the work of moving the eyes and head to track a target

track(settings) → {Vector2}

Find the horizontal and vertical angle that will rotate a joint towards a target

Parameters:
Name Type Description
settings Dict

dictionary of variables

Properties
Name Type Description
parentTransform Transform

parent transform of the joint

lookDir Vector3

global vector pointing towards target

lookMinH float

minimum horizontal angle defined by clips

lookMaxH float

maximum horizontal angle defined by clips

lookMinV float

minimum vertical angle defined by clips

lookMaxV float

maximum vertical angle defined by clips

lookAngleMinH float

actual minimum horizontal angle

lookAngleMaxH float

actual maximum horizontal angle

lookAngleMinV float

actual minimum vertical angle

lookAngleMaxV float

actual maximum vertical angle

trackBrows(xValueopt, yValueopt)

Blend the eyebrow direction poses

Parameters:
Name Type Attributes Description
xValue float <optional>

horizontal parameter to blend by

yValue float <optional>

vertical parameter to blend by

trackEyes()

Blend the eye and eyelid direction poses

trackHead(isSmallMove, worldLookDir)

Blend the head/neck direction poses

Parameters:
Name Type Description
isSmallMove boolean

if set to true, head tracks slow, otherwise it tracks at normal speed

worldLookDir Vector3

the world direction to look at