Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
Hi pals, since this comes down to coding I though I should rather try it here than in the CopperCube-Forum^^ I have arranged a button (2D overlay) in Coppercube with the action "when clicked do something". This should execute the following: when clicked > gotoScenebyName > when switching the scene has completed >then load a specific mesh in that scene > get sure it loads everything properly (like: engine.ingComplete or else) So when executed it should go to another scene and load a mesh in that switched scene - all done over one button. Isn't that possible?! I tried it with that script, but it isn't working: _______________ var engine = new CL3D.CopperLicht('3darea'); { gotoSceneByName("OnlyThePlayer"); engine.load('copperlichtdata/mesh1.ccbjs'); engine.ingComplete = function() { alert("loading completed") }; } _______________ I think my code in general is crap. But shouldn´t it work somehow like this? Maybe with a line inserted to just load the mesh once the scene has changed.. Please help Thx KK |
||||
|
From looking at your code, it looks fine. But I take a closer look at this and see if I can find your problem. This could take one or two days though. Hint: Maybe you can find your problem yourself by simply taking a look into the JavaScript console, if there is any error. This is often the case. |
||||
|
I figured that the action "gotoSceneByName" isn't working at all. Here is the script executed by a button ("when clicked do something"): ------------------------------ var engine = new CL3D.CopperLicht('3darea'); { engine.gotoSceneByName("OnlyThePlayer"); } ------------------------------ It definitely runs the script - but nothing happens. It doesn't even show a error in the JavaScript console.. The rest of the new script works fine (no JS-errors) and the mesh is loaded (plus texture): ------------------------------ var engine = new CL3D.CopperLicht('3darea'); { engine.load('copperlichtdata/mesh1.ccbjs'); engine.getTextureManager().getCountOfTexturesToLoad(); engine.ingComplete = function() { alert("loading completed") }; } ------------------------------ So why would the gotoScenebyName-method not work? Thx KK |
||||
|
I'm not sure, currently, but I'll look into this within the next hours. |
||||
|
Cheers!! |
||||
|
Hi pals.. Niko worked it out and I wouldn´t mind sharing this: It will explain how to call a user-defined function via a button. Remember that you can replace (in the HTML-file)
with
Now additional functions may follow. In my case it switches to another scene AND externally loads a 3D-mesh.. Here is the full source-code:
Then simply arrange a button in CopperCube with the action: "WhenClickedDoSomething" > "ExecuteJavaScript" > insert here: "dosomething(); loadcustommesh()" (or however your functions are called..) Hope this will help^^ Once you feel insulted by such a basic thread, please see my next post on "dynamically load external mesh"..^^ For a good solution I might pay some money. Lets get it on.. Regards KK |
||||
|
This last code doesn’t load the specified mesh (mesh1.ccbjs) in the scene2 of test.ccbjs. Simply loads the mesh1.ccbjs and destroy (overwrite?) test.ccbjs. I will mention that copperlict.js is the SDK one, not the copperlict.js generated by CopperCube when publish as WebGL. HTML5 + javaScript buttons variant: http://estudio3d.eu/coppercube/L... CopperCube button (with two functions) variant: http://estudio3d.eu/coppercube/t... In this last example, when try to list the name of second scene we got error in console.log because scene2 doesn't exist in the new scene (sphere.ccbjs) Do you know how to insert(?) new geometry without destroying the original scene? |
|