Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Programming and Scripting
Applying rotation from one scene node to another

j9907
Registered User
Quote
2019-07-15 11:53:00

Not working:


var Yeti = ccbGetSceneNodeFromName ('Yeti');

var mainPos = ccbGetSceneNodeProperty ('Yeti', 'Rotation');

var pos2 = ccbGetSceneNodeProperty ('Yeti1', 'Rotation');

var Yeti2 = ccbGetSceneNodeFromName ('Yeti1');

ccbSetSceneNodeProperty (Yeti2, pos2, mainPos);


Basically I have a character who follows a path and, when the player comes within a certain proximity, it hides itself and another node will teleport to the position it was at and I want the other node to take the rotation so it looks seamless, but this code isn't working. It says:

Code not get property, provided scene node is invalid.
Property does not exist: false

The first error makes no sense as I named the scene nodes exactly as it appears in the code!


yalazkan
Registered User
Quote
2019-07-15 21:34:06

Before the 3th line, you have to define "Yeti1"....

var Yeti1 = ccbGetSceneNodeFromName ('Yeti1');


srfstudio
Registered User
Quote
2019-07-17 02:19:05

This is how I move move/rotate nodes:
var Yeti1_pos = ccbGetSceneNodeProperty(ccbGetSceneNodeFromName("Yeti1"), "Position");

var Yeti1_rot = ccbGetSceneNodeProperty(ccbGetSceneNodeFromName("Yeti1"), "Rotation");

ccbSetSceneNodePositionWithoutCollision(ccbGetSceneNodeFromName("Yeti2"), Yeti1_pos.x, Yeti1_pos.y, Yeti1_pos.z);

ccbSetSceneNodeProperty(ccbGetSceneNodeFromName("Yeti2"), "Rotation", Yeti1_rot.x, Yeti1_rot.y, Yeti1_rot.z);
The code moves/rotates Yeti2 to Yeti1's position/rotation. I always leave x,y,z available in case nodes don't exactly match so that I can tweak numbers but if they are the same you can just pass single variable.


j9907
Registered User
Quote
2019-07-17 13:06:32

Thanks all! It's fixed!


Create reply:


Posted by: (you are not logged in)


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