Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Feature requests and bug reports
Randomize the positions of some scene nodes

pk12
Registered User
Quote
2017-04-20 22:09:53

CopperCube API doesn't return mesh data for animated objects... but you can attach your animated object to a cube and make the cube transparent:
🔎︎


It's actually the proper way to do this because it's faster than calculating bounding box of a complex animated model and additionally you can have collision


TD_9844
Guest
Quote
2017-04-24 12:08:37

For me it doesn't work.

If I choose "transparent (alpha channel)", "transparent (add)" or "transparent fake reflective" in materials of the cube, the cube is still visible
Is that a problem because of the mac OS target maybe?


pk12
Registered User
Quote
2017-04-24 17:18:36

Download this transparent texture http://i.imgur.com/VQ0M59t.png, set as cube material and change type to "Transparent (Alpha channel)".


TD_9844
Guest
Quote
2017-04-27 22:50:03

pk12 thanks again,
Now the randomization works perfectly, but there is another big problem:

I found that when in before first drawing do somethingt I put these two: Load JavaScript API Wrapper and LoadMyGame, a LOT of things aren't working anymore.

For example: when the player is near a scene node, a 2dOverlay should pop up:
On proximity do something --> if a variable has a value do something --> execute javascript:
var pan = ccbGetSceneNodeFromName('panel');
ccbSetSceneNodeProperty(pan,'Visible',true);
So the problem is that when I load the JS API Wrapper and MyGame, when I go near that scene node, this would appear:
CopperCube Debug Console
Could not set property, provided scene node is invalid.
And the code above isn't working :(

If I delete the Load JS API Wrapper and Load MyGame from before first drawing do somethingt, everything is working fine again.

If instead of the code above I use the behaviour Hide or unhide a scene node, everything works, both with API and without.
But I have a lot of code like this in my games, so I can't switch to use behaviours everytime instead of coding

Is that a problem with my macbook, or is it a limitation of the API Wrapper?


pk12
Registered User
Quote
2017-04-28 01:14:58

The problem is that the API wrapper assigns unique ID to each node and that ID is stored in node name because currently there's no other way to store custom properties. So if you've a node named "cube", it'll become "cube:::1" and ccbGetSceneNodeFromName won't find it.

I've however found a solution to that problem so you won't need to change anything in your code, but it'll take a day or two to implement - I'll let you know when it's ready.


TD_9844
Guest
Quote
2017-04-28 02:59:01

Thanks man... What you are doing will help many coppercubers, great job!


pk12
Registered User
Quote
2017-04-28 23:14:34

Thanks, I'm glad to help :)

I've released new version of the wrapper, please let me know if it solves your problem.


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