Adding interactivity to SVOYA interior (Playcanvas/WebGL). Part 2
This is part 2 of the 5 series of lessons on adding interactivity to the SVOYA Apartment interior.
Access to materials, such as: models in the "FBX" format, baked textures, scripts and more, you can get by subscribing to Patreon.
PatreonView the Playcanvas project online.
View Playcanvas Project OnlineCreate a "configurator" folder in "scripts" of the "Assets" panel.
Add a brush image.
In order not to create identical buttons from scratch, we will simply duplicate the existing ones.
Make a duplicate of the “PlayPause” button, name the new button “ChangeColor”, name the picture “PaintImage”. Delete the "PauseImage" image.
For the "PaintImage" image, select "paint.png".
Place a “ChangeColor” button next to the cabinets object as shown in the image below.
The button is ready, it remains to add the color change script.
Add the “change-color.js” script to the “scripts/configurator” folder.
Script "change-color.js".
Apply the script to the desired object, in our case it is “Cabinet”. To do this, select an object, add “Component” “Script” and select “changeColor” from the dropdown list.
Note!
It is worth noting that the script will change the colors of the "Diffuse" in the material, so the "Lightmap" of the material should have a black and white texture of baked shadows.
Material settings “Cabinet_2048”.
In the “changeColor” script settings, specify the material for which the color will change in the “Material” parameter.
Be sure to specify the “Trigger Button” - this is the button that will activate the color change.
In the “Colors” parameter, specify a number, how many colors there will be.
Next, adjust the colors.
Ready! Run the project, you should change colors by pressing the "ChangeColor" button.
In this part of the tutorial, we made a simple material color change configurator.
Patreon subscribers will be able to view the SVOYA Apartment project in read mode, as well as quickly copy-paste the necessary assets and scripts into their personal project.
For everyone else, you will find everything you need on the page of this lesson.
PatreonFAQ
1. What is this article about?
2. How is Part 2 different from Part 1?
3. Should I read Part 1 before Part 2?
4. What new features are introduced in Part 2?
5. Can these techniques be used in other PlayCanvas projects?
6. Is this approach suitable for interior configurators?
7. Can I create custom user interface elements?
8. Does interactivity improve project presentations?
9. Can objects be modified in real time?
10. How important is optimization when adding new features?
11. Can these projects run on mobile devices?
12. Is PlayCanvas suitable for commercial applications?
13. Do I need JavaScript knowledge for advanced functionality?
14. Can the project be expanded after publication?
15. What are the benefits of interactive WebGL presentations?
16. Who is this article useful for?
Vasyl Lukianenko is a 3D artist and technical author focused on practical workflows, optimization, and production-ready techniques. He publishes tutorials, courses, and tools to help artists work faster and get cleaner results.
All posts by this author










{{comment.text}}