Change color of mesh using mouseover in three js

后端 未结 2 770
情书的邮戳
情书的邮戳 2021-02-20 06:23

I\'ve put together a WebGL script that displays several meshes using jsonloader and three.js and I now want to add MouseOver and onClick events. The first of these is simply cha

2条回答
  •  既然无缘
    2021-02-20 06:58

    As the code in the answer above is outdated (I tried it)... you can take a look at threex.domevents library. It did the trick in my case.

    threex.domevents is a three.js extension which provide dom events inside your 3d scene. Always in a effort to stay close to usual pratices, the events name are the same as in DOM. The semantic is the same too, which makes it all very easy to learn. Currently, the available events are click, dblclick, mouseup, mousedown, mouseover and mouse out.

    Here's an example that uses it:

    http://bl.ocks.org/fabiovalse/2e8ae04bfce21af400e6

提交回复
热议问题