Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
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: $(document).ready(function(){ Disclaimer: I'm a web nerd, not an engine nerd. Thanks! |
||||
|
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(); That's it. :) |
||||
|
Hey niko, Thanks! 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? |
||||
|
Yes, sure. Everything is in realtime. Just replace 'yourCanvasID' in my code above with 'model'. |
||||
|
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... |
||||
|
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() (note no spaces between On Loading Complete :) ) |
||||
|
Got it, thanks niko! |
|