threlte
threlte copied to clipboard
THREE.Points not available
While Mesh
has been implemented fine, Points
has not been put in. It can be bodged in very easily, but duplicating the Mesh.svelte
, replacing
setup(new THREE.Mesh(geometry, material));
with
setup(new THREE.Points(geometry, material));
and fiddling around with exports, but there may well be a more efficient way of doing things.
Good point! (Ha! I'll see myself out.)
Indeed Mesh
and Points
share quite a lot. I'm undecided how to deal with that.
In the meantime it's rather easy to implement that yourself:
<script>
import { Points } from 'three'
import { Object3DInstance, useFrame } from 'threlte'
const points = new Points(…)
const posX = 0
useFrame(() => {
posX = Math.sin(Date.now() / 1000)
})
</script>
<Object3DInstance position={{ x: posX }} object={points} />
The threlte component <Mesh>
is providing raycasting which you probably don't want on a THREE.Points
object anyway?
Ahh I see, this is better than my bodged solution, thanks
With Threlte 6, the APIs now exactly mirror the ThreeJS API.