I’m a bit new to dynamic components, and wonder if there is a ‘recommended’ or ‘best practise’ for creating animated dynamic components.
Let me explain by the attached example: Animation grouping.skp (93.5 KB), containig six doors (2 red, 2 blue and 2 green).
Each door has a door and frame component, assembled into an assembly group or component.
Each door has an “Opening
” variable, and the RotZ = -Opening
, so it opens up when Opening is between 0° and 90°.
For the front red door, onClick
(attached to the door pane) animates Opening
between 0° and 60°.
Now, if I simply copy the RedDoorAssembly, an onClick on any red door animate all red doors. Great, but that’s not how it works (at least not in my house ).
Now I see two options to solve this:
For the blue doors, the onClick
is attached to the Assembly (instead of the door). In this case, SketchUp will automatically make this component unique (make a copy of it).
Another (similar) solution is to make the assembly a group instead of a component instance, as is done for the green doors. In that case it is not possible to attach the onClick
to the assembly, but things work just fine when attached to the door.
The disadvantage of the blue and green door is that if I change something about the assembly, I have to change it at each instance (they don’t share a single component definition).
I have three questions:
- What is the recommended way to do things? The blue or the green door? Or is this a matter of personal preference?
- Is there a way to have separate animated doors where the assembly shares a single component definition?
- A bit technical question: Why do the red and green doors behave differently? In both cases, all variables and attributes (RotZ, Opening, onClick) are attached to the door, not to their group or assembly. Why would they behave different depending of where in the Outline hierarchy they are located? With other words, where is the animation ‘state’ (in this case the RotZ state) stored? I assume in the instance of the door.
(This last question surely shows I’m a newbie here, I just try to understand things a bit better).