ambiera home ambiera home

Ambiera Forum

Discussions, Help and Support.

Create a new account, Search, or Login:
Name:  Password:
Ambiera Forum > CopperCube > Programming and Scripting
Replace a scene node with a different scene node "help"
Author Text

Registered User
2018-09-14 17:15:14

Hi! is someone able to help with making a new action that "replaces a scene node with a different scene node"... Example "ActionOnDie" replace the current mesh or billboard/scene node with a totally different mesh or billboard/scene node.... I guess similar to Hide or unhide a scene node but instead of hiding the scene node it is being replaced by another scene node.


2018-09-14 19:27:15

this can already be done in the editor by simply deleting the scene node and changing the position or cloning and changing the position of desired scene node simultaneously. but you are wanting a javascript action for this?

Registered User
2018-09-15 02:48:56

Hi! thanks for the reply! i'm aware that what i'm asking can be achieved in this manner, though the end result is a lot of busy work. If the effect was a scripted action "replace a scene node with a different scene node" it would eliminate this busy work and make work flow faster! particularly if a project has several scene nodes that need to be changed each to a completely different scene node...

2018-09-15 08:12:17

ah I see. well then you will probably want to create a .js file named action_replace.js and then add something like this to it...

/*  <action jsname="action_replace" description="Replace current scene node with a different scene node">
<property name="ReplacementNode" type="scenenode" />
action_replace = function()
action_replace.prototype.execute = function(currentNode)
var curPos = ccbGetSceneNodeProperty(currentNode, "Position");
var sourceNode = this.ReplacementNode;
var newscenenode = ccbCloneSceneNode(sourceNode);
ccbSetSceneNodeProperty(newscenenode, "Name", "replacer");
ccbSetSceneNodeProperty(newscenenode, "Visible", true);

Registered User
2018-09-15 15:25:10

Thank you so much! i really appreciate that you took the time to do this, the script works like a charm...

Create reply:

Posted by: (you are not logged in)

Enter the missing letter in: "Internation?l" (you are not logged in)




Forum Codes

Feature Code
Link [url] [/url]
Bold [b]bold text[/b]
Image [img][/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]



Software: Ambiera Light Forum. © 2008-2019 Nikolaus Gebhardt, Ambiera e.U.