Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperLicht
Cameras and Viewports

Registered User
2012-05-15 20:53:13

Hi there,

First time using CopperCube and CL, so far enjoying every minute of it! I'm building an app to showcase boat models in a variety of ways. I may be going about this the wrong way, just looking for a little direction.

My scene has 5 cameras: Top, Left, Right, Front, and Perspective. Pretty much the same as viewports. I'm using <li> elements with data attributes to pass camera names. ex:

<li data-view="Top">Top</li>

Any hints on how I could change cameras in the scene when the <li> element is clicked?

Using jQuery to get data attribute:

//Get the view from the data-view attribute after click
var $view = $(this).attr("data-view");

//trickery with CL3D.Scene

Disclaimer: I'm a web nerd, not an engine nerd.


2012-05-16 06:31:17

I don't know much about jquery (not a web nerd *g*), but what you probably simply want is switching the active camera to another camera in your scene, correct? It should work fairly easily:

You usually get the object of your engine using something like this:
var engine = new CL3D.CopperLicht('yourCanvasID'); 

or if you started using the editor, this:
var engine = startCopperLichtFromFile('yourCanvasID', 'someFile.ccbjs');

Once you have this and you are sure your scene is loaded and running (which I guess you are in the click handler of your list), you can switch to another camera using this:

var scene = engine.getScene();
var cam = scene.getSceneNodeFromName('theNameOfYourCamera');
if (cam != null)

That's it. :)

Registered User
2012-05-16 17:33:44

Hey niko,


I am using the editor to build my scenes because these are pretty high polycount models imported from 3DS as COLLADA.

One thing I forgot to mention in my last post is that the file is already loaded and running in a canvas with an ID of "model"

Can I use this method to manipulate the render instantly without reloading and redrawing?

2012-05-17 06:26:35

Yes, sure. Everything is in realtime. Just replace 'yourCanvasID' in my code above with 'model'.

Registered User
2012-05-18 20:58:49

Hey again niko,

I can't seem to get a value for scene from engine.

I've looked at the array in Firebug and CurrentScene = -1 and the Scenes array is empty.

In the Editor I have two Scenes, Solid and Solid-Two, both with a folder node.

I feel like I'm not doing something that should be obvious...

2012-05-19 10:49:21

You probably looked when the file wasn't loaded yet. Do something like that (as shown in most CopperLicht tutorials):

engine.On Loading Complete = function() 
var scene = engine.getScene();
if (!scene)

// your code here

(note no spaces between On Loading Complete :) )

Registered User
2012-05-22 16:49:56

Got it, thanks niko!

Create reply:

Posted by: (you are not logged in)

Enter the missing letter in: "Inter?ational" (you are not logged in)




Possible Codes

Feature Code
Link [url] [/url]
Bold [b]bold text[/b]
Image [img][/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]



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