Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clickable Button effect in threejs

I placed a Mesh element in the threejs from fbx file. I want to add an effect (or filter) for Mesh element like clickable button.

I want to add effect the pushable button like in the first button style from https://saruwakakun.com/en/css3-buttons

enter image description here

Is there any library for this?

like image 769
Danil Chernokalov Avatar asked Dec 15 '19 07:12

Danil Chernokalov


1 Answers

I doubt you can find a library for something so specific. What you want to achieve is fairly simple to implement though.


The button can be any Mesh (or any Object3D).

A simple way to achieve the visual effect, is to change the button's position when it's clicked.

In order to detect when the button is clicked, you should listen to MouseEvents on the canvas and use a ray caster to detect which object is under your mouse cursor with your camera (see this example or this question).

like image 63
peoro Avatar answered Nov 01 '22 16:11

peoro