GithubHelp home page GithubHelp logo

aframe-vrm's Introduction

VRM Components for A-Frame

A-FrameVRM のモデルを動かすコンポーネントです.

Features

  • Animation
  • BlendShape (Morph)
  • Physics (using CANNON.js)

Demo

  • Live DEMO
  • Live DEMO(Physics) (using aframe-physics-system)
  • VRM/GLB,BVH/VMDファイルをブラウザにドラッグ&ドロップするとプレビューできます(アップロードはされません)
  • WebVRはOculus Questでテストしています

AliciaSolid

Usage

<html>
<head>
  <script src="https://cdn.jsdelivr.net/gh/aframevr/[email protected]/dist/aframe-master.min.js"></script>
  <script src="https://binzume.github.io/aframe-vrm/dist/aframe-vrm.js"></script>
</head>
<body style="background-color: black; color:white;">
  <a-scene>
    <a-entity vrm="src:assets/AliciaSolid/AliciaSolid.vrm;blink:true" vrm-anim="" rotation="0 180 0"></a-entity>
    <a-camera position="0 1.6 2"></a-camera>
  </a-scene>
</body>
</html>

npm: @binzume/aframe-vrm

Components

  • vrm: Load vrm model
  • vrm-bvh: Play BVH/VMD animation
  • vrm-poser: pose editor for VR
  • vrm-skeleton: display skeleton
  • vrm-mimic: TODO

vrm

Attributes:

name type default desc
src string None VRM model URL
blink boolean false Auto blink
blinkInterval number 5 Auto blink interval
lookAt selector None look at target element
firstPerson boolean false Hide head meshes

Properties:

avatar : VRMAvatar

Events:

name event.detail desc
model-loaded {format:'vrm', model: Object3D, avatar: VRMAvatar} Loaded event
model-error {format:'vrm', src: URL, cause: object} Error event

Compatible with gltf-model component: https://aframe.io/docs/1.0.0/components/gltf-model.html

vrm-poser

Pose editor.

Attributes:

name type default desc
color color green box color
enableConstraints boolean true Enable bone constraints

vrm-anim

Play bvh/vmd animation.

Attributes:

name type default desc
src string '' BVH file url
format string '' vmd or bvh (default: auto detect)
convertBone boolean true Convert bone name

srcを空にすると待機アニメーションが再生されます(テスト用).

Building aframe-vrm

cd aframe-vrm
npm install
npm run lint
npm run build

VRMAvatar API

See: avatar.ts

import {VRMLoader} from "./dist/aframe-vrm.module.js"

const scene = new THREE.Scene();
const avatar = await new VRMLoader().load("test.vrm");
scene.add(avatar.model);

Property:

  • VRMAvatar.model : THREE.Object3D
  • VRMAvatar.mixer : THREE.AnimationMixer
  • VRMAvatar.lookAtTarget : THREE.Object3D
  • VRMAvatar.bones : VRM bones
  • VRMAvatar.blendShapes : blend shapes
  • VRMAvatar.meta : VRM meta data

Methods:

  • VRMAvatar.update(timeDelta)

  • VRMAvatar.dispose() : Dispose VRM avatar.

  • VRMAvatar.setBlendShapeWeight(name, value) : Set blend shape weight for name.

  • VRMAvatar.getBlendShapeWeight(name) : Returns blend shape values.

  • VRMAvatar.resetBlendShape() : Reset all blend shapes.

  • VRMAvatar.resetPose() : T-Pose

  • VRMAvatar.startBlink(intervalSec)

  • VRMAvatar.stopBlink()

  • VRMAvatar.setFirstPerson(firstPerson)

  • VRMAvatar.modules.physics.attach(world : CANNON.World) : Start physics.

  • VRMAvatar.modules.physics.detach() : Stop physics.

TODO

License

MIT License

aframe-vrm's People

Contributors

binzume avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aframe-vrm's Issues

Animation loader module is loaded from threejs.org

This can cause unexpected issues with three.js updates. Also, if threejs.org goes down, the demos will stop working.

e.g. #3

This should be resolved at build time instead of loading dynamically. however, we don't want to include three.js in the pre-built aframe-vrm.min.js because aframe.js also contains three.js.

Cannot load animation loaders

Hi
I am trying to load animations but getting below errors. Our app uses three-133 so I tried forking the repo and updating three version to 133 and 137. Tried calling models from imported Three, as written here without success. I am trying to load VMD animation (that works with three-pixie and others) but when I load your BVHs they don't work as well. Looks like BHVs in your demo don't work too, the console gives out some three issues. This is a very nice component you have here and want to use it in production, will be glad if you have an idea about the issue. thank you.

ERROR in ./node_modules/@binzume/aframe-vrm/dist/aframe-vrm.module.js
Module not found: Error: Can't resolve 'https://threejs.org/examples/jsm/animation/CCDIKSolver.js' in  /@binzume/aframe-vrm/dist'
 
ERROR in ./node_modules/@binzume/aframe-vrm/dist/aframe-vrm.module.js
Module not found: Error: Can't resolve 'https://threejs.org/examples/jsm/loaders/BVHLoader.js' in ' node_modules/@binzume/aframe-vrm/dist' 

ERROR in ./node_modules/@binzume/aframe-vrm/dist/aframe-vrm.module.js
Module not found: Error: Can't resolve 'https://threejs.org/examples/jsm/loaders/BVHLoader.js' in 'node_modules/@binzume/aframe-vrm/dist'
 @ ./node_modules/@binzume/aframe-vrm/dist/aframe-vrm.module.js 576:30-93
 @ ./src/react-components/parts/AvatarItem.js
 @ ./src/react-components/create/CreatePage.js
 @ ./src/create.js

 

First person doesn't work

Hello in the demo, first person doesn't work...

Is it possible to use this for player's avatar ?

Thanks

Works only on Chrome

Does load but not animate on Firefox

(with physics.html > error : Unknown property width for component/system geometry.)
(with demo basic > error : Uncaught (in promise) TypeError: Erreur lors de la résolution du spécificateur de module « three ». Les spécificateurs de module relatifs doivent commencer par « ./ », « ../ » ou « / ».)

Couldn't make it work on an iPhone too.

Thanks a lot!

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.