Please use https://demo.readyplayer.me/ to create half-body avatars which are compatible with this project.
Grand Canyon by Jason Thompson on Unsplash
This starter kit lets you deploy your Wolf3D/ReadyPlayer.Me avatars on your personal webpage using three.js.
This repository is based on: superguigui/threejs-starter-kit
Special thanks to Zakir Baytar (@zakirbaytar) for helping me refactor the code to make it more human-readable and maintainable.
- Deploy Wolf3D/ReadyPlayer.Me avatars using three.js
- ES6 with Babel and Webpack.
- Animations and morph targets.
- Cursor tracking.
- node.js & npm
After cloning install all node dependencies
npm iThen launch the main task to open the livereload server
npm startYou are good to go!
npm run buildThen put the content of the dist folder on your server.
Debug tools can be included in development mode. This can be done by using the DEVELOPMENT environment variable that is set by webpack.
if (DEVELOPMENT) {
const gui = require('package-name') // will not be included in production
}- Create your avatar and place the .glb file in
assets/models. - In
config.js, edit:defaultAvatar.urlAvatarSettingsDOMSettings
- In
AvatarSettings.morphTargets, each element has the properties:key(string)targetValue[0-1]transition(ms)duration(ms)
- When building and deploying through
npm run build, have adivwith idDOMSettings.avatarDivID(config.js). E.g.<div id="3d_avatar"></div>
To see available morph targets and animations, view your avatar on: https://gltf-viewer.donmccurdy.com/
- Classes in
src/objectsextendTHREE.Object3D. - Factory pattern is used to create
container,renderer,scene, andcamera. - Builder pattern is used to add components to
SceneandAvatar. THREEglobal keyword is avoided.- Necessary components are imported from
three:
import { Object3D, Mesh, MeshBasicMaterial } from 'three'See superguigui/threejs-starter-kit for more information.
- Similar to MonoBehaviour class in Unity development, scene objects can implement
updatefunction to execute at each frame.
Avatar.js:
update(delta) {
this.rotateHead();
this.mixer.update(delta);
}index.js, render():
..
scene.main.traverse((element) => element?.update?.(delta));
..
