Ambiera Forum

Discussions, Help and Support.

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

starx78
Registered User
Quote
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");
ccbSetCopperCubeVariable("savePosition",curPos);

load behavior:

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

please anyone make this script for me :)


VP
Guest
Quote
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)


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