Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Programming and Scripting
Making plugin, but how do i make a reference to a scenenode?

poliginal
Registered User
Quote
2021-04-07 14:18:19

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




just_in_case
Moderator
Quote
2021-04-08 05:15:00

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.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "In?ernational" (you are not logged in)


Text:

 

  

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