Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperLicht
Pause, Resume, Stop the engine or the scene

xakiru
Registered User
Quote
2012-04-17 15:43:37

Hi,

I was wondering if there are a way to pause the rendering or/and copperlicht engine, then resume it.


niko
Moderator
Quote
2012-04-18 07:39:06

Hm, currently, there is no way to do this. But you could probably add something like this by overwriting the timer function. It currently looks like this:

CL3D.CLTimer.getTime = function()
{
var d = new Date();
return d.getTime();
}

If you overwrite it by returning the same time always if the game is paused, it could work. Maybe. :)


xakiru
Registered User
Quote
2012-04-18 14:56:09

Thanks, yep it works like a charm.


jquindlen
Registered User
Quote
2013-11-18 04:08:36

I'm using this code:


try {
CL3D.CLTimer.getTime = function() {
if(isBlgStatWindow == false) {
var d = new Date();
return d.getTime();
} else {
return 1;
}
}
} catch(err) {

}


Basically, if my Inventory/Stat window is open, I want to pause Copperlicht engine. This is for an RPG game, so realtime pausing to use items, equipment, etc. is kind of the expected norm. You know, you get in a fight, your HP is low, so you pause the game, go into your inventory and drink a potion to restore your HP type of thing.

However, my code, which does stop the engine, has some side effects. For example, when it pauses, all my animated meshes move several points higher in height. When the game is unpaused, they fall from this height according to gravity. I also notice when I unpause that Copperlicht redisplays the "Loading..." text as if the scene is being reloaded from scratch. Furthermore, the more I pause and unpause the game, the worse the performance is. One pause and unpause is enough to cause the game to lurch, stutter like crazy.

My window is destroyed each time it is closed, so I do not believe the issue is with the window. Rather, since Copperlicht seems to completely reinitialize itself each pause (the models reseting height plus the Loading... text is what gives me that impression) I would assume the issue is more with pausing.

Any insight or alternative pausing methods that you can think of? Thanks Niko ;)


niko
Moderator
Quote
2013-11-18 20:50:47

I think the reason is that it notices that there is a huge gap between the times the function delivers before and after the pause. So if you just continue to deliver a continuous value, the effect would be reduced.


dipendra
Guest
Quote
2014-06-10 22:56:24

Can anyone tell me how to stop a copperlicht engine.

I have this

var engine = startCopperLichtFromFile ....

and I was looking forward to seeing an API like

engine.Stop();

But it turns out that there is none.

I have this html page with various scenes in a dropdown and I want to switch between scenes. Suggestions? A less standard way would be to simply refresh the page.


niko
Moderator
Quote
2014-06-11 09:32:15

There is the possibility to add multiple scenes into one file, and switch scenes whenever you want. This is probably what you need?

Alternatively, another idea would be - if you prefer multiple files - to embed your 3D website in your website using an iframe HTML tag, and switch the url of that iframe in order to show the scene you need.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Internat?onal" (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