Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
I am using CopperLicht 1.12 to load a .ccbjs file created in CopperCube 5.4.2 as the main scene. I am uploading at runtime some blocks as .ccbz file created in CopperCube 5.4.2 The main scene contain a grid, a camera and an original mesh who has two animators ('on_click') and ('keypress') The imported blocks has no animators. When a block is imported (uploaded), I am cloning the two animators of original mesh and add them to new uploaded block (mesh). All work fine and the uploaded blocks can be dragged by the added animator Drag3D Object by Axis Constraintand dropped by right mouse button click = the second animator. But I want to remove the two animators from the blocks already moved. For that I am using var animator = yourSceneNode.getAnimatorOfType('keyboardcontrolled'); But that doesn't work for me. The blocks can still be dragged, yet they appear without animators (see console messages). Can anyone help to remove animators? Thanks in advance. the code I used for buttons function to load the blocks at runtime:
The link to the working sample: http://estudio3d.eu/blocks |
||||
|
Hm, you are removing the animator "keyboardcontrolled" as it seems. The extension behaviors created for CopperCube are not ordinary animators, but of type AnimatorExtensionScript. All of them have the name 'extensionscript'. So you would be able to remove them with that name. For WebGL, the animator object additionally then has a property named 'JsClassName', if it is a AnimatorExtensionScript. That then has the name as specified in the extension script, like "action_Drag3DObject_axis", you could check for that additionally, and see if you want to delete that animator. Hope this helps! |
||||
|
keyboardcontrolledwas just as example. Actually I am removing 'on-click'and 'keypress' Beware, the Forum editor doesn't allow "on-click" in a body, have to remove the dash. It's a composed animator 1: on_click do Drag 3D Object and 2. on right click (keypress event) do Drag3D Object but with all axis restricted, in order to drop the node (mesh). I need to drop the object not only on-click object, but on-click anywhere on the scene, included outside object. Maybe I can alter the extension script, to drop node not only on-click object but on-click outside object too. In this mode I need to use only one animator: on-click do Drag·dObject. Thank you for the advice. I'm going to try the property "JSClassName" and I'll let you know if I get anything. |
|