Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperLicht
Job offer: Dynamically load external mesh

kingkohle
Registered User
Quote
2010-12-10 15:00:16

Hi there,


I posted an earlier thread about externally loading meshes. This is covered very well now. The next step is to do this dynamically.

I guess this is where the variables enter the stage. The idea is to click on an object (2DOverlay) which will be loaded in another scene (It loads the 3D-mesh). See the thread "Externally load specific mesh" to find out about that.

Now: Its got to be possible to call these by name, right?! What if the 2DOverlay has the same name as the mesh to be loaded - say the 2DOverlay is called Gun1 and the mesh we gonna display is also called Gun1 (more specific it is called: Gun1.ccbjs)..

So set some variables like:

if (nameOf2DOverlay) equal to (nameOfmesh.ccbjs) then load it

or simply

if (nameOf2DOverlay) than load mesh with same name (sameNameOfmesh.ccbjs)


This is where YOU are in charge^^ For the most convenient solution I might pay some money. Hints and thoughts are very welcome.



Thx
KK


niko
Moderator
Quote
2010-12-11 06:49:46

It would also work like this: In the button, simply call your function with a variable as parameter to load the mesh and the scene. Like in the On Click behavior of the button add an 'Execute JavaScript' action which calls your function like this:
loadMyMesh('thisOne');

and in another button do this
loadMyMesh('theOtherOne');

For example. Not sure if this is working in your case.


kingkohle
Registered User
Quote
2010-12-14 19:22:11

simply call your function with a variable as parameter to load the mesh

Not sure how to achieve this. My problem is that I dont know how the variables interact. Therefore I dont know whether it meets my requirements.

The idea is to load a mesh without setting/changing the behaviour of any single scene node (as there are plenty).. Therefore I was hoping you can combine behaviours (or scene node name) and variables. Unfortunatly, I cant find any Tutorial how to dynamically load external files (but javascript.js)

A Tutorial would be nice (as I found several threads like this in the CL-Forum). I will write one for you once I figured this out..

@bagg: You mentioned the same issue a while ago. Any updates on that?

@niko: Also: When double-clicked over the <canvas> it highlights the fonts below.. Any chance to get rid of that? Imagine a button to zoom in: once you click to fast it selects the text below. This wont be good for some actions.. Will this be solved? Or do we have to work around it?


Reg
KK


niko
Moderator
Quote
2010-12-15 07:49:29

wrote:
[quote]
@niko: Also: When double-clicked over the <canvas> it highlights the fonts below.. Any chance to get rid of that? Imagine a button to zoom in: once you click to fast it selects the text below.


I think this is the browser doing that. Difficult to say, you can try to work around this somehow, and probably depends on the browser.


kingkohle
Registered User
Quote
2010-12-15 11:47:56

True..

Its just Chrome Canary Build when it highlights the text. They might get rid of that once they figure it out.

I just recognized that FF isn't displaying "Umlaute" - but Chrome does it. Maybe its a bug at the rear end?!


bagg
Registered User
Quote
2010-12-15 13:03:10

Hi

You can write a script that creates a meshscenenode to your current scene
then you can set as current scene the other scene that you have the object that you want to load get it with scene.getMeshSceneNodeByName then get it's mesh and copy it to the meshscenenode of the first scene.You will need one script for each button.


kingkohle
Registered User
Quote
2010-12-15 17:13:02

Thx bagg.. I will dig into it.

I assume the mesh must be attached within that (other) scene (it is not loading externally - but from another scene)? If that is the case: would the scene you actually never go to (but getting copies from) require to be loaded before displaying the current scene??

Please also see my other thread on the "mouse pointer-issue":

http://www.ambiera.com/forum.php...

Maybe this affects you as well. Cheers


KK


bagg
Registered User
Quote
2010-12-16 08:53:35

I assume that you are using coppercube.If that so you must create both scenes in coppercube put the objects that you want to transfer in the second scene and save the file as ccbjs.Then you must start the scene with engine = startCopperLichtFromFile('3darea', 'copperlichtdata/YourScene.ccbjs');


bagg
Registered User
Quote
2010-12-16 08:59:09

About the other thread i am not familiar with games so i don't know.....


kingkohle
Registered User
Quote
2010-12-16 17:23:27

Yes Im using CopperCube also..

Thx for the hint. I came along good by externally load them. But using external JavaScripts for every mesh might be a good idea.. You could set the mesh-infos there and display it in the canvas as well. So thumbs up!


Thx
KK


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