Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Help with CopperCube
Position reference by javascript

srfstudio
Registered User
Quote
2019-01-18 21:45:36

I'm not sure what form I should use to make Position property readable for other nodes :(

This code is functioning but I have to write the XYZ coordinates manually:
var sourceNP1 = ccbGetSceneNodeFromName("np1");
var newscenenode1 = ccbCloneSceneNode(sourceNP1);
ccbSetSceneNodePositionWithoutCollision(newscenenode1, 100.0, 10.0, 100.0);
What I need is something like this:
var np1pos = ccbGetSceneNodeFromName("box1");
var np1_pos = ccbGetSceneNodeProperty(np1pos, "Position");

var sourceNP1 = ccbGetSceneNodeFromName("np1");
var newscenenode1 = ccbCloneSceneNode(sourceNP1);
ccbSetSceneNodePositionWithoutCollision(newscenenode1, np1_pos);
I have tried...
np1_pos.x, np1_pos.y, np1_pos.z / np1_pos[0], np1_pos[1], np1_pos[2]
...but it's not working.

Does anyone knows how I should break Position property as a var/vector so that I can use it as a reference for other nodes?


srfstudio
Registered User
Quote
2019-01-18 22:24:43

...sorry, the np1_pos.x, np1_pos.y, np1_pos.z is working :)
I've made a mistake few steps before that part of the code.


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