@bedrock-viewer/model-viewer
v0.1.1
Published
Loads and renders Minecraft Bedrock models and animations with three.js.
Readme
@bedrock-viewer/model-viewer
Loads and renders Minecraft Bedrock models and animations with three.js. Inspired by bridge-core/model-viewer.
Install
pnpm add @bedrock-viewer/model-viewer threeUsage
import { BedrockModel } from '@bedrock-viewer/model-viewer'
const [geometry, animations] = await Promise.all([
fetch('./frog.geo.json').then((res) => res.json()),
fetch('./frog.animation.json').then((res) => res.json()),
])
const model = await BedrockModel.load({
geometry,
geometryName: 'geometry.frog',
texture: './frog.png',
})
scene.add(model.object3D)
const idle = BedrockModel.loadAnimationClip(animations, 'animation.frog.idle')
model.playAnimation(idle)
// In your render loop
model.update(deltaSeconds)