Object3d troisjs has setup call and emit events for mesh and init set mesh for handle users data.
As well get parent scene and renderer checks. When the create/mount/setup event default by vue api.
Note that mesh.userData is being used to assign component and physics.
It can found in src/core/object3d.
https://github.com/troisjs/trois/blob/master/src/core/Object3D.ts
emits: ['created', 'ready'],
https://github.com/troisjs/trois/blob/master/src/meshes/Mesh.ts
mounted() { // TODO : proper ? if (!this.mesh && !this.loading) this.initMesh() },
It depend on the vue component setup.
function initMesh(iMesh){ iMesh.userData.mass = 1; iMesh.userData.collisionFilterGroup = GROUP1; iMesh.userData.collisionFilterMask = GROUP3; }
<Box @created="initMesh" :position="{ x: 0, y: 10, z: 0 }"> <PhongMaterial color="#ffffff" /> </Box>
There was an error while loading. Please reload this page.