I have weird behaviour, when I pick the body ok I can change the color when next I pick the wheel, the body and wheels get new color why?
But when I first (after load of app) pick wheel the wheels get color changed so ok
If both the body and the wheels use the same material, then it’s expected to get the same color when you update that said material.
If you would like to change the color only on a specific mesh instance / instances, then you have to either clone the material (use unique materials per model) or use setParameter instead of updating the material.
both are get updated, but not when I pick body(when I pick at first body I get name:“Mat.009”),
but pick body then try pick wheel then both are get updated
In other words: after load I pick the wheels and change color: only wheels are updated
next I refresh the page and I pick the body and change color so the body is updated
but when I try to pick body then wheels so change color of wheels ( then it works like selecting sth with ctrl)
in this case not only the wheels are updated
the third case is weird it should not acts like this
vice versa works similar ( I mean when pick the wheels then body the both are updated)
so conclusion is
body -> wheels (both updated)
wheels -> body (both updated)
it works like it remembers the previous state why?
what I want?
when pick in this order:
body -> wheels (change wheels color, wheels updated)
wheels -> body (change body color. body updated)
by picking I mean only click on part not change color
Hmm, the problem could be related to the way you are attaching and firing an event from the HTML element. You can remove the material update from there and just add some debug console.log. Check that the log appears only once in the console when you pick different objects.
As a side note, it is very hard to read your code. Please, follow some common coding style. Here is a good guideline, for example: