Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Help with CopperCube
Could not set property on scene node: CCB JS API

Guest
Guest
Quote
2023-06-08 18:22:24

note for "missing" images: i dont know why, but in some browsers images are not displayed (maybe because of CORS), so under the image find the "Zoom" button, right click on the "missing" image icon and click "Open in new tab". im using my own file uploader service - http://cringe.rf.gd
its safe to use, and has been written by me in free time. source code: https://github.com/marshallovski...

when im trying to set 'Visible' property on some node (in my situation - arm with pistol), ccb is returning me an error for some reason. note: im placing this code at "Before first draw" in scene root, maybe its somehow impacting; I think the error occurs because the node doesn't exist yet, and I'm calling a function for its getting

🔎︎


🔎︎


🔎︎


Code:


var handAiming = ccbGetSceneNodeFromName('pistolhand-aiming');
var handNormal = ccbGetSceneNodeFromName('pistolhand-normal');

var handAimingVisible = ccbSetSceneNodeProperty(handAiming, 'Visible');
var handNormalVisible = ccbSetSceneNodeProperty(handNormal, 'Visible');

// 0 = left mouse btn
// 1 = right mouse btn
// 2 = middle mouse btn
function mouseBtnHandler(button) {
if (button === 1) {
print('switching hands; handNormal: ' + handNormalVisible + ' , handAiming: ' + handAimingVisible);

// auto visibility set, aka "Toggle visibility" in CCB editor
ccbSetSceneNodeProperty(handNormal, 'Visible', !handAimingVisible);
ccbSetSceneNodeProperty(handAiming, 'Visible', !handNormalVisible);

}
}

ccbRegisterMouseDownEvent('mouseBtnHandler');



Guest
Guest
Quote
2023-06-08 23:20:12

var cube = ccbGetSceneNodeFromName('cubeMesh1');

function mouseBtnHandler(button) {
if (button === 1) {

var cubeVis = ccbGetSceneNodeProperty(cube, 'Visible');

if(cubeVis) ccbSetSceneNodeProperty(cube, 'Visible', false);
if(!cubeVis) ccbSetSceneNodeProperty(cube, 'Visible', true);

}
}

ccbRegisterMouseDownEvent('mouseBtnHandler');



VP
Guest
Quote
2023-06-10 01:30:37

Not sure if it will work but you could try doing the following:

Before First Draw, Do something later (1000ms), Execute Java Script........

So it only executes the script after the node is created.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Interna?ional" (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