Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Programming and Scripting
save/load position?

Registered User
2023-06-01 22:04:44

the position of a scene object must be saved as a variable.
the object should be moved to the location of this variable saved without collision. how to do this with javascript?

I write this but don't work:

save behavior:

var player=ccbGetSceneNodeFromName("Camera1");
var curPos=ccbGetSceneNodeProperty(player,"Position");

load behavior:

var player=ccbGetSceneNodeFromName("Camera1");
var savePosition =ccbGetCopperCubeVariable("savePosition");
ccbSetSceneNodePositionWithoutCollision(player, savePosition);

please anyone make this script for me :)

2023-06-02 11:16:48

I can't do coding at all but this line doesn't look correct:

var savePosition =ccbGetCopperCubeVariable("savePosition");

Also, you've introduced spaces before the savePosition variables on some lines of code and not on others. Coppercube will see them as different variables if just a single character is different.

Create reply:

Posted by: (you are not logged in)

Enter the missing letter in: "Inter?ational" (you are not logged in)




Possible Codes

Feature Code
Link [url] [/url]
Bold [b]bold text[/b]
Image [img][/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]



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