ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperCube > Programming and Scripting
forum topic indicator save/load position?
person icon
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 :)

person icon
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:










 

  

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


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






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