1.0.4 • Published 2 years ago

@meetkaims/npc-babylonjs v1.0.4

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 years ago

NPC SDK for Babylonjs

Installation

yarn add @meetkaims/npc-babylonjs

or

npm i @meetkaims/npc-babylonjs

Basic usage

create avatar

const avatar = new Avatar(scene, { assetUrl, apikey });
await avatar.create();

Add AudioContext to babylon Engine.

  • pass audioContext and use babylon engin's global audio context
const engine = new Engine(canvas, true, {
   audioEngine: true,
   audioEngineOptions: { audioContext: new AudioContext() },
});
  • audio context can be accessed
scene.getEngine().getAudioContext();

Inference text request

  • ask avatar a questio◊n by passing text
avatar.inferenceText({
   npcId: 19,
   endUserId: 123,
   voiceId: 'Giorgio',
   message: 'hello what are you doing',
});

Inference speech

  • starts microphone, listens for speech. Ask quesiton by talking
await avatar.inferenceSpeech({
   npcId: 19,
   endUserId: 123,
   voiceId: 'Giorgio',
});

Avatar positions

get avatar position & rotation

console.log(avatar.position);
console.log(avatar.rotation);

set avatar position & rotation

avatar.setPosition(new Vector3(0, 0, 0));
avatar.setRotation(new Vector3(0, 0, 0));
1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago