Hi guys,
i was wondering if it is possible to have two steps of highlighting a mesh.
Just imagine: You hover with your mouse over a mesh and it is highlighted in white as long as your mouse pointer stays on it. When you leave it, the highlight layer disappears. If you click the mouse, the mesh is highlighted permanently in blue. But what happens now, if you hover over a already clicked one?
There I would like to have a third color.
Any suggestions how to achive this?
greets
You could achieve this by using different materials.
Something like this: You have 4 different materials.
Material 0 - Initial Color
Material 1 - Initial Hover Color
Material 2 - Click Color
Material 3 - Hover color After Click
On hover on:
If material = 2, set material to 3
Else set material to 1
On hover off:
If material = 3, set to material 2
Else set to material 0
On click:
Set material to 2
Something like that should probably work.
2 Likes
That sounds quite good! Do you have any examples or playgrounds, where I can test this?
I found somehting about Multi Materials : Use Multi-Materials - Babylon.js Documentation
But how can i decide, which one is active?