Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
Hello there. I have been testing out this great engine for a couple of days now. And i thought that i would help with sharing and making some plugins etc. I almost have a working plugin, but how do i reference a object?: Here is my code: // called when the action is executed action_Test.prototype.execute = function(currentNode) { var s = ccbGetSceneNodeFromName("cubeMesh1"); //Don't know how to make a direct reference to the scenenode. var position = ccbGetSceneNodeProperty(this.ObjectToFollow, "Position"); var rotation = ccbGetSceneNodeProperty(this.ObjectToFollow, "Rotation"); var mouseX = ccbGetMousePosX(); var mouseY = ccbGetMousePosY(); var pos = ccbGet2DPosFrom3DPos(mouseX, mouseY); var pos3d = ccbGet3DPosFrom2DPos(mouseX, mouseY); ccbSetSceneNodeProperty(s, "Position", pos3d ); } As you can see this plugin only works if my objects name is "cubeMesh1". So have do i make a reference to a scenenode? Thanks for the help in advance |
||||
|
You can simply use "currentNode" to refer to the scene node on which the plugin (action is attached to. Or if you want you can create an XML embedded property type "scenenode" in your action to specify the node in action itself in the editor. |
|