How to interact with objects in the scene?
joram56 opened this issue · 1 comments
joram56 commented
I would like to run some functions or display some toasts when users click on various objects in the scene, is that possible at the moment? Or is this a feature request?
Something like
<script>
import * as THREE from 'three';
import * as SC from 'svelte-cubed';
</script>
<SC.Canvas>
<SC.Mesh
on:click={()=>{console.log("running my function")} <<--------- THIS
geometry={new THREE.BoxGeometry()} />
<SC.PerspectiveCamera position={[1, 1, 3]} />
</SC.Canvas>
joram56 commented
This is the best solution I have found.
https://codesandbox.io/s/basic-threejs-example-with-re-use-dsrvn
Would be nice if these things can happen behind the scenes and you can just do a simple on:click(), not sure how possible that is.