Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
Author | Text | ||||
|
I'm trying to make a combination lock, four numbered cylinders that rotate when clicked I can do it with with "change rotation of scene node" then "rotate by rotation" but I can't see how to do this using a script ccbSetSceneNodeProperty(currentNode, "Rotation",36.0,0.0,0.0 ); just turns it the first 36 degrees, I can't figure out how to add rotate by rotation It seems easy enough to do without the script with a few variables checking turn count etc where's the fun in that ![]() It would be nice to do my own action were I could enter a combination code and generally learn...I'm new to js and Coppercube |
||||
|
nigec wrote: I'm trying to make a combination lock, four numbered cylinders that rotate when clicked I can do it with with "change rotation of scene node" then "rotate by rotation" but I can't see how to do this using a script ccbSetSceneNodeProperty(currentNode, "Rotation",36.0,0.0,0.0 ); just turns it the first 36 degrees, I can't figure out how to add rotate by rotation It seems easy enough to do without the script with a few variables checking turn count etc where's the fun in that ![]() It would be nice to do my own action were I could enter a combination code and generally learn...I'm new to js and Coppercube If you set it 36 then it will be 36.. it doesnt ADD 36 but sets it to be fixed 36. to ADD 36 use this.. var OldRot=ccbGetSceneNodeProperty(currentNode, "Rotation"); var NewRot=OldRot.x +36; ccbSetSceneNodeProperty(currentNode, "Rotation", NewRot,0,0 ); OR use variable.. variable Xrot=36; Xrot+=36; ccbSetSceneNodeProperty(currentNode, "Rotation",Xrot,0.0,0.0 ); If you didnt understand then feel free to ask again.. i make example if you need it. |
||||
|
Thank you sven, yes that works ![]() is it possible to animate the rotation? |
||||
|
wrote: Thank you sven, yes that works ![]() is it possible to animate the rotation? I edited my door script so you see how it can be done.. Klick on box to rotate it.. You can set time (how long it should rotate) and int value how much it should rotate. Here is example: https://drive.google.com/file/d/... You can look into DoLater script to understand how this kind of stuff can work. Probably there is many ways how to do it.(depends how you need to make it work) |
||||
|
thank you for your time, I'm getting there, I have all the dials turning and a check to see if each dial has done a full rotation and resets the rotation back to zero once it has very impressed with Coppercube so far |
||||
|
this is what I've come up with so far and it seems to work:
|
|