How to change the material of HolographicButton

Hello,
I have a question for this example:

The frontMaterial is a read only property, and this example is using set a new material in frontMaterial, and it works. But I am doing it in my project in VScode, it does’t works. Should I change the library to add the set function ? (ps: I have the last version of babylonjs.), I got same issue with StackPanel3D, I want to change the material of stackPanel.

Thanks.

Hello and welcome!
What properties exactly do you want to change on the button’s material? It might be not necessary to change the material itself, and also more efficient.

1 Like

If it’s just the color, you only need to set it for both enter and up observables. Else, you will get erratic coloring because as you said it’s shared. But if you set both for each button, it works:

Thanks for your reply !! I want to change the colour of the button and make it a little bit transparency. You are right, I should juste change the material itself !

Thanks for this link playground !! I understand better, any chance that you know how to add a background in stackPanel3D ? I want to do a sidebar with buttons, so I would like to have a background in stackPanel3D.

It’s not possible to add a background to StackPanel3D since it’s just a container for 3D elements, but you could create a plane behind the panel to serve as “background”: Babylon.js Playground (babylonjs.com)

2 Likes

Thanks!!! :blush: