ambiera home ambiera home

Ambiera Forum

Discussions, Help and Support.

Create a new account, Search, or Login:
Name:  Password:    
Ambiera Forum > CopperCube > Help with CopperCube
Position reference by javascript
Author Text

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: "Intern?tional" (you are not logged in)


Text:

 

  

Forum 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


   





Software: Ambiera Light Forum. © 2008-2018 Nikolaus Gebhardt, Ambiera e.U.