UNPKG

@vrspace/babylonjs

Version:

vrspace.org babylonjs client

122 lines (121 loc) 4.55 kB
/** * Base avatar class, provides common methods for actual humanoid/video/mesh avatars * @abstract */ export class Avatar { /** Whether to display the name above the head, default true * @static*/ static displayName: boolean; /** Should written/spoken text be displayed above the head, default true * @static*/ static displayText: boolean; /** Should we use 3d text (as opposed to Label and TextArea) - performance penalty * @static */ static use3dText: boolean; /** @param scene @param folder ServerFolder with the content @param shadowGenerator optional to cast shadows */ constructor(scene: any); scene: any; /** Name of the avatar/user */ name: any; /** Height of the user, default 1.8 */ userHeight: number; /** Distance for text above the avatar */ textOffset: number; /** Animation frames per second, default 10 */ fps: number; humanoid: boolean; video: boolean; /** Original root mesh of the avatar, used to scale the avatar */ /** Whether to display the name above the head, defaults to value of static displayName */ displayName: any; /** Should written/spoken text be displayed above the head, defaults to value of static displayText */ displayText: any; /** Should 3d text be used for name/spoken text, defaults to value of static use3dText */ use3dText: any; writer: TextWriter; nameLabel: Label; emojiParticleSystem: EmojiParticleSystem; /** Custom nodes to be disposed when this avatar is disposed */ attachments: {}; /** Set the name and display it above the avatar. The avatar needs to be displayed first. @param name */ setName(name: any): Promise<void>; processText(text: any, limit: any, lines?: any[]): any[]; /** * Write locally generated text, used internally * @param wrote text to write above the head */ write(wrote: any): Promise<void>; textArea: TextArea; /** * Remote event routed by WorldManager, displays whatever user wrote above avatar's head * @param client Client that wrote a text */ wrote(client: any): Promise<void>; /** Remote emoji event routed by WorldManager/EventRouter */ emoji(client: any, node: any, direction?: number): Promise<void>; /** Returns the URL of the avatar file */ getUrl(): void; /** Returns the top-level mesh of the avatar */ baseMesh(): void; /** Returns the current base position of the avatar, e.g. where the feet are */ basePosition(): void; /** Position of top of the avatar, default implementation returns basePosition()+topPositionRelative() */ topPositionAbsolute(): any; /** Position of top of the avatar, default implementation returns userHeight Vector3 */ topPositionRelative(): any; /** Position of text above the avatar, default implementation returns topPositionRelative()+textOffset */ textPositionRelative(): any; /** Add an attachment to the attachment object */ attach(name: any, node: any): void; /** Delete an attachment, does not dispose */ detach(name: any): void; /** * Shortcut for this.attachments.hasOwnProperty(name) */ containsAttachment(name: any): boolean; /** Disposes of all attachments */ dispose(): void; /** * Handles position change network event * @param {VRObject} obj contains already changed position * @param {*} node babylon node */ positionChanged(obj: VRObject, node: any): void; /** * Handles rotation change network event * @param {VRObject} obj contains already changed rotation * @param {*} node babylon node */ rotationChanged(obj: VRObject, node: any): void; /** * Handles name change network event * @param {VRObject} obj contains already changed name * @param {*} node babylon node */ nameChanged(obj: VRObject, node: any): void; /** * @param {User} obj */ meshChanged(obj: User, node: any): void; /** * @param {User} obj */ videoChanged(obj: User, node: any): void; /** * @param {User} obj */ humanoidChanged(obj: User, node: any): void; } import { TextWriter } from '../core/text-writer.js'; import { Label } from '../ui/widget/label.js'; import { EmojiParticleSystem } from '../ui/world/emoji-particle-system.js'; import { TextArea } from '../ui/widget/text-area.js'; import { VRObject } from '../client/vrspace.js'; import { User } from '../client/vrspace.js';