Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Help with CopperCube
Enable/Disable Fog

shadynl
Registered User
Quote
2023-07-21 01:15:02

I like to enable fog on command with Javascript, for example :

when a button is pressed: activate fog.

The manual only speaks of the option ''fog color'. Is there a command to enable/disable all fog for the WebGL target and not just the color? It would greatly enhanced my scene!

thanks in advance.

I have already tried: var root = ccbGetRootSceneNode();

ccbSetSceneNodeProperty (root, "Fog", false);

Neither 'True or 'False' seem to work whilst it is no problem at all to change the color???


okeoke
Registered User
Quote
2023-07-21 06:54:50

Edit: this also only workes on windows.
Fog property seems to work only for windows target.

You can set fog density to 0 for webgl as the scene starts:
let node = ccbGetRootSceneNode()
ccbSetSceneNodeProperty(node, 'FogDensity', .0);

Then set it to a required value as player presses the button.


okeoke
Registered User
Quote
2023-07-21 07:17:32

If you un minify copperlicht.js file, you can see that there is only FogColor property, as you already mention:
🔎︎



okeoke
Registered User
Quote
2023-07-21 07:28:36

Lol, you can just directly modify fog density property. Just call:
n.$.qa.Ih = 0;

To disable fog
n.$.qa.Ih = 0.007;

To set density back.


shadynl
Registered User
Quote
2023-07-21 18:17:23

Thank you OkeOke for your quick reply.

I somehow found the solution for my scene by simply enabling fog and set the density to 0. Look at the difference this makes in this short video.https://www.youtube.com/watch?v=...


Create reply:


Posted by: (you are not logged in)


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