Simple Swing Door onclick

I am trying to animate a door to swing open onclick.

I have drawn the simplest rectangle and pushed it into a 3d shape.

I have made this shape into a component and set its axes to the corner that I wish it to hinge at.

I have then created a dynamic attribute of onclick: animate(RotZ,0,90).

This works well, but the door swings the wrong way.

If I change the onclick to read: animate(RotZ,0,-90), then click the door, it opens the right way, but the second click has not visual affect, but there is now an attribute called -90 who’s value changes each time I click from 0 to -90 and back.

Can anyone offer a suggestion on how I can resolve this?

Door.skp (160.2 KB)

you could use animate(“rotz”,0,-90) provided smart quotes is off (mac issue)

1 Like

Yes, most times it is beter to use an xtra attribute (eg. DoorAngle, DoorWidth,etc) , and refer the standard attributes to them(eg. RotZ=DoorAngle). do the Animatefunction on that custom attribute.(eg. OnClick=Animate(“DoorAngle”,0,50,90)
Btw. You can animate more then one attributes with one ‘OnClick’, (‘;’ as seperator)
AnimateCustom gives you some control over the speed of the animation.
Check this thread:

1 Like

Thank you so much for your help.

I have now created a custom field against each sub-component and set the click animation on the parent.

Now when I click, the doors open.

Thank you again, that has solved it for me.