attatching dynamic light to a camera node

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Dan911
Posts: 21
Joined: Tue Dec 16, 2008 11:28 pm

attatching dynamic light to a camera node

Post by Dan911 »

In latest svn update, example 21 loads a q3 map and a player node which has collision and a weapon model parented to the player node. I have been trying to attach a dynamic light to the player node also, but am having some trouble.

I have been trying to addLightSceneNode and parent it to the player node. The code compiles, but i see no light. I would really appreciate it if somebody helped point me in the right direction.

Here is my code for adding a light( based on API documentation http://irrlicht.sourceforge.net/docu/cl ... 37ccdb7095)

Code: Select all

// add light to player scene node
	scene::ILightSceneNode* light1 = 
		smgr->addLightSceneNode(
		smgr->getActiveCamera(), //parent node
		core::vector3df(0,0,0),
		video::SColorf(0.5f, 1.0f, 0.5f, 0.0f), 200.0f);
I think my possible errors could be:
  • setting a light to a parent node does not also set the original pos of the light also(parameter 3)

    the light is not being rendered

    i am not setting the parent correctly
Here is the code from example 21, my code starts at line 277
http://irrlichtirc.g0dsoft.com/paste/328
Dan911
Posts: 21
Joined: Tue Dec 16, 2008 11:28 pm

Post by Dan911 »

tried setting setMaterialType(video::EMT_SOLID) of the map, no avial, now entire map just bright
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

How about enabling lighting on the node?
twilight17
Posts: 362
Joined: Sun Dec 16, 2007 9:25 pm

Post by twilight17 »

I'm pretty sure lighting isn't enabled on Quake 3 maps. You have to change the material type to one of these:

http://irrlicht.sourceforge.net/docu/na ... 549b799855

EDIT: Most likely EMT_LIGHTMAP_LIGHTING.
Post this userbar I made on other websites to show your support for Irrlicht!
Image
http://img147.imageshack.us/img147/1261 ... wernq4.png
Post Reply