Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperLicht
LightSceneNode

badcommandorfile
Registered User
Quote
2013-05-25 09:15:07

Hi niko,

I'm trying to add lights to my scene. Creating a LightSceneNode without a LightData object like this:

var scenenode = new CL3D.LightSceneNode();

scene.getRootSceneNode().addChild(scenenode);

scenenode.Pos = pos;

Creates a light, but the Pos is always 0,0,0.

The CL3D.Light documentation also has a Position member (not sure how this differs from the parent SceneNode Pos member). Attempting to add a LightData to the LightSceneNode like this:

var ldata = new CL3D.Light();
var scenenode = new CL3D.LightSceneNode();
scenenode.LightData = ldata;

scene.getRootSceneNode().addChild(scenenode);

ldata.Position = pos;

Causes no light to be cast in the scene at all! I've tried also setting the Color and Attenuation of ldata, but all I seem to get is darkness.

How can I create a light at some point other than 0,0,0? I'm using Copperlicht 1.6.1.

Thanks,


niko
Moderator
Quote
2013-05-26 07:15:14

Hi,

to change the position of the light, you only need to change the position of the light scene node, just like with all other scene node types, so that was right. The problem is maybe how you set the position. Is your 'pos' variable maybe null, or undefined or similar? You can test with alert(pos.toString()), for example. Also, maybe you are setting the position correctly, but since you are not copying it, maybe you are modifying the position afterwards again, so a safe way to set the position would be to use

scenenode.Pos = pos.clone();


Maybe this helps.


Create reply:


Posted by: (you are not logged in)


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