Meshes
You can easily create mesh :
<Box :size="1" :position="{ x: 10, y: 0, z: 0 }">
<BasicMaterial />
</Box>
You can use the following meshes :
Box
(source, threejs doc)Circle
(source, threejs doc)Cone
(source, threejs doc)Cylinder
(source, threejs doc)Dodecahedron
(source, threejs doc)Icosahedron
(source, threejs doc)Lathe
(source, threejs doc)Octahedron
(source, threejs doc)Plane
(source, threejs doc)Polyhedron
(source, threejs doc)Ring
(source, threejs doc)Sphere
(source, threejs doc)Tetrahedron
(source, threejs doc)Torus
(source, threejs doc)TorusKnot
(source, threejs doc)Tube
(source, threejs doc)
Mesh.ts)
Common Props (seeName | Description | Type | Default |
---|---|---|---|
position | Position | Object | { x: 0, y: 0, z: 0 } |
rotation | Rotation | Object | { x: 0, y: 0, z: 0 } |
scale | Scale | Object | { x: 1, y: 1, z: 1 } |
castShadow | Cast shadow ? | Boolean | false |
receiveShadow | Receive shadow ? | Boolean | false |
To enable shadows, please read Shadows.
Example :
<Box
:position="{ x: 0, y: 0, z: 0 }"
:rotation="{ x: 0, y: 0, z: 0 }"
:scale="{ x: 1, y: 1, z: 1 }"
:cast-shadow="false"
:receive-shadow="false"
>
<BasicMaterial />
</Box>
Access ThreeJS mesh
You should set a ref on your mesh :
<Box ref="box" />
You can then access ThreeJS mesh in your component script :
const mesh = this.$ref.box.mesh;