Git Product home page Git Product logo

avatars's Introduction

Exokit Avatars

SiteDocsDiscordTwitterEmail List

Hands Reality Tab Live Reload Magic Leap Tutorial Reality Tab

The only web-based avatar system you need.

  • Loads GLB, FBX, VRChat, VRoid, .unitypackage humanoid
  • Auto-detects rigs, height, orientation
  • World scale matching
  • HMD + gamepads input
  • Bones orientation output
  • Arms, legs inverse kinematics
  • Walking kinematics
  • Face animation (visemes) with microphone
  • Hair/clothing animation

How it works

import './three.js';
import Avatar from 'https://avatars.exokit.org/avatars.js';

const avatar = new Avatar(model, { // model is the gltf object that includes the scene, can use https://github.com/exokitxr/model-loader
  // all options are optional

  // animate fingers
  fingers: true,

  // animate hair
  hair: true,

  // remove head for first person
  decapitate: false,

  // animate visemes (blink, mouth, etc.)
  visemes: true,
  // navigator.mediaDevices.getUserMedia({audio: true}); // microphone input for visemes
  microphoneMediaStream,
  // false to passthrough microphone audio
  muted: true,

  // add debug bone geometry
  debug: true,
});

avatar.setMicrophoneMediaStream(microphoneMediaStream); // set microphoneMediaStream separately

function animate() {
  const now = Date.now();
  avatar.inputs.hmd.position.set(0, 1.5 + Math.sin((now%2000)/2000*Math.PI*2)*0.5, 0); // or, get pose from WebXR
  avatar.inputs.leftGamepad.position.copy(avatar.inputs.hmd.position).add(new THREE.Vector3(0.2, -0.3, -0.3));
  avatar.inputs.leftGamepad.pointer = 0.5; // for finger animation
  avatar.inputs.leftGamepad.grip = 1;
  avatar.inputs.rightGamepad.position.copy(avatar.inputs.hmd.position).add(new THREE.Vector3(-0.2, -0.3, -0.3));

  avatar.setFloorHeight(0) // sets the floor height that exokit uses to determine the pose

  avatar.update();

  requestAnimationFrame(animate);
}
animate();

avatars's People

Contributors

avaer avatar msub2 avatar eriksom avatar rangermauve avatar lalalune avatar shu8 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.