≡
Products
▼
Support
▼
Company
▼
Forum
Ambiera Forum
Discussions, Help and Support.
Create a new account
,
Search
, or Login:
Create reply in
removeAnimator(a)
Posted by:
(you are not logged in)
Enter the missing letter in: "Internatio?al"
(you are not logged in)
Text:
[quote][b]madalin[/b] wrote: 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 [b]two animators ('on_click') and ('keypress')[/b] The imported blocks has no [b]animators[/b]. 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 [code] Drag3D Object by Axis Constraint [/code] and dropped by right mouse button click = the second animator. But I want to [b]remove the two animators[/b] from the blocks already moved. For that I am using [code]var animator = yourSceneNode.getAnimatorOfType('keyboardcontrolled'); // store the animator for later adding it again somehow yourSceneNode.removeAnimator(animator); [/code] [b]But that doesn't work for me.[/b] 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: [code] loadModel = function(path){ engine.load(path, true, function(){ nodeindex ++; var importedNode = engine.getScenes()[1].getSceneNodeFromName('mesh'); engine.getScene().getRootSceneNode().addChild(importedNode); var scenesArray = engine.getScenes(); scenesArray.pop(); importedNode.Name = importedNode.Name + nodeindex.toString(); importedNode.Id = nodeindex; var meshNodes = scene.getAllSceneNodesOfType('mesh'); var numberOfNodes = meshNodes.length; console.log("Number of Nodes: ",numberOfNodes); for(var i=0;i<numberOfNodes;i++){ console.log("Name: ", meshNodes[i].Name, " index: ",meshNodes[i].Id) } var originalMesh = scene.getSceneNodeFromName('mesh'); var originalAnimatorsArray= originalMesh.getAnimators(); var animator1 = originalAnimatorsArray[0].createClone(importedNode, scene, originalMesh.Id, importedNode.Id); var animator2 = originalAnimatorsArray[1].createClone(importedNode, scene, originalMesh.Id, importedNode.Id); importedNode.addAnimator(animator1); importedNode.addAnimator(animator2); if (nodeindex != 1) { console.log("Nodeindex: ",nodeindex); var meshToRemoveAnimators = scene.getSceneNodeFromName('mesh' + (nodeindex - 1).toString()); var animatorToRemove1 = meshToRemoveAnimators.getAnimatorOfType(''); var animatorToRemove2 = meshToRemoveAnimators.getAnimatorOfType('keypress'); console.log("animatorToRemove1:", animatorToRemove1); console.log("animatorToRemove2:", animatorToRemove2); meshToRemoveAnimators.removeAnimator(animatorToRemove1); meshToRemoveAnimators.removeAnimator(animatorToRemove2); console.log(meshToRemoveAnimators.Name,": ",meshToRemoveAnimators.getAnimators()); console.log(meshNodes[1].Name,": ",meshNodes[1]); } }) }; [/code] The link to the working sample: [url]http://estudio3d.eu/blocks[/url][/quote]
Possible Codes
Feature
Code
Link
[url] www.example.com [/url]
Bold
[b]bold text[/b]
Image
[img]http://www.example.com/image.jpg[/img]
Quote
[quote]quoted text[/quote]
Code
[code]source code[/code]
Emoticons
Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact