ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperCube > Programming and Scripting
forum topic indicator Making plugin, but how do i make a reference to a scenenode?
person icon
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

emoji icon_grin

person icon
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.emoji icon_holyemoji icon_holy


Create reply:










 

  

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


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |