UNPKG

@vrspace/babylonjs

Version:

vrspace.org babylonjs client

75 lines (74 loc) 2.15 kB
/** * Helper to figure out which animation to use, based on names of animation groups. * Most important ones are idle and walk. * Used by AvatarController and BotController. */ export class AvatarAnimation { /** * @param {Avatar} avatar */ constructor(avatar: Avatar); /** @type {Avatar} */ avatar: Avatar; /** Names of all animations availalbe */ animationNames: any[]; /** * Animation metadata, TODO extract to its own class, document all fields */ animations: { walk: { substring: string; preferredSubstring: string; avoid: string[]; }; walkLeft: { substring: string; preferredSubstring: string; }; walkRight: { substring: string; preferredSubstring: string; }; walkBack: { substring: string; preferredSubstring: string; }; idle: { substring: string; useShortest: boolean; }; run: { substring: string; useShortest: boolean; }; }; /** Animations other than idle/walk/run */ otherAnimations: any[]; /** If this is true, processText() may trigger animations */ improvise: boolean; /** * Called from constructor to find walk and idle animations. */ processAnimations(): void; contains(name: any): any; /** Do we know walk animation? */ canWalk(): boolean; /** @returns animation metadata object for walk, object.group is actual AnimationGroup */ walk(): { substring: string; preferredSubstring: string; avoid: string[]; }; /** @returns animation metadata object for idle, object.group is actual AnimationGroup */ idle(): { substring: string; useShortest: boolean; }; /** * Process what user/bot said and see if there's any meaningful avatar animation to trigger. * @param {string} text * @returns babylon AnimationGroup or null */ processText(text: string): any; } import { Avatar } from './avatar.js';