@anima-virtuality/onlybots-three v3.4.0
Onlybots THREE.js
THREE.js helpers for Onlybots, built on onlybots-core. This module can be used in vanilla THREE.js or @react-three/fiber.
Usage
npm i @anima-virtuality/onlybots-threeReference
Note: the docs below are not exhaustive, but should cover the most common use cases.
OnlyBotThree
A helper class that generates THREE.js geometry and materials for an OnlyBot.
Properties
min: Point3The minimum point of the bounding box of the bot. Note that voxels are cubes centered at coordinates with a l/w/h of 1, so the bot geometry will extend by 0.5 past the min.
max: Point3The maximum point of the bounding box of the bot. Note that voxels are cubes centered at coordinates with a l/w/h of 1, so the bot geometry will extend by 0.5 past the max.
center: Point3The center of the bounding box of the bot.
anchor: Point3The anchor value of the bot. See OnlyBot for more info.
meshes: OnlyBotThreeMesh[]
Methods
static create(bot: OnlyBot, presets: OnlyBotMaterialPreset[]): OnlyBotThreeCreates an OnlyBotThree instance from an OnlyBot instance and presets.
constructor(min: Point3, max: Point3, center: Point3, anchor: Point3, meshes: OnlyBotThreeMesh[])Creates a new
OnlyBotThreeinstance.dispose()Disposes the geometry and materials of the bot.
OnlyBotThreeMesh
A class that holds the geometry and material for one material of an OnlyBot.
Properties
geometry: THREE.BufferGeometryCombined geometry for all voxels of this material.
material: THREE.MeshPhysicalMaterialThe material for this mesh.
bloom: booleanWhether this mesh should be rendered with bloom.
Methods
dispose()Disposes the geometry and materials of the bot.
OnlyBotMaterialPreset
A type that defines the specific properties for a material to look correct in THREE.js
The current list of preset can be found in current-presets.json