Flashlight

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
Colton450
Posts: 5
Joined: Sun Feb 14, 2010 11:22 pm

Flashlight

Post by Colton450 »

So, I'm creating a program to simulate what it would be like to jump on the moon and a few of the planets to be projected onto a bigscreen in front of a few hundred kids... intended to get them interested in physics...

My problem is, I have my scene set up so that a few seconds after landing on the moon the sun rises up over the horizon and casts light over the surface. Until then, I want to have a flashlight to make it seem a bit more realistic... Sadly, I have no earthly idea how to make the flashlight effect.

Well, almost no idea... while typing this I thought of something that might work... but it's a long shot.

Could I possibly render a cylinder around the light source? Even if this would work... if there are any better ways to do this, please explain.
ent1ty
Competition winner
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Post by ent1ty »

Code: Select all

ILightSceneNode* flashlight; 
flashlight= smgr->addLightSceneNode(); 
SLight flashlightData; 
flashlightData.Direction= camera->getRotation(); 
flashlightData.OuterCone= 20; 
flashlightData.Position= camera->getPosition(); 
flashlightData.Falloff= 30; 
flashlightData.Type= ELT_SPOT; 
flashlight->setLightData(flashlightData); 
flashlight->setRadius(20);
flashlight->setParent(camera);
Post Reply