Variable: Follower
const
Follower:Component
<{_followTarget
: {default
: [number
,number
,number
];type
:Vec3
; };behavior
: {default
:string
;enum
: {FaceTarget
:string
;NoRotation
:string
;PivotY
:string
; };type
:Enum
; };maxAngle
: {default
:number
;type
:Float32
; };needsPositionSync
: {default
:true
;type
:Boolean
; };offsetPosition
: {default
: [number
,number
,number
];type
:Vec3
; };speed
: {default
:number
;type
:Float32
; };target
: {default
:any
;type
:Object
; };tolerance
: {default
:number
;type
:Float32
; }; }>
Defined in: packages/core/src/ui/follow.ts:44
Makes an entity follow a target Object3D
with optional rotation behavior.
Remarks
PivotY
keeps the follower level while rotating around the Y axis to face the target.FaceTarget
fully rotates to look at the target.NoRotation
only moves position.
Example
ts
entity.addComponent(Follower, {
target: xrRig.head,
offsetPosition: [0.25, -0.2, -0.35],
behavior: FollowBehavior.PivotY,
speed: 5,
tolerance: 0.3,
})