Problems with edit object actuator and lights

I’m trying to figure out how to make a gun shoot bullets.

I place a bullet object in a non visible layer. Then I use the edit object on the gun with the add feature. When i start the game the gun shoots the bullets, but they’re flat.

I’ve edited the faces and added light settings. But the bullets are not lighted by the light in the active/visible layer.

Even if I add a light in the bullet layer, the bullet are lighted/shaded now, but light is coming from the center of the world, and not from the light I’ve added and moved.

Please help,
and sorry for my poor english.

Ciacio

select your bullet object,press “F” then select Set light from drop down menu.

If you’re telling me to set the light button on every face, I’ve already done it.

Pressing F goes to the UV/Face select, is it right? Is it correct to have the light just on the active/visible layer?

ciacio

You are proboably missing something:

http://img36.exs.cx/img36/2985/faces.png

If you already know that, then add a lamp in the non-active layer and see what happens.

I’ve already done it.

Doing that will light the bullet, but the light is coming from a fixed direction. Changing light position doesn’t affect illumination.

I don’t think this method is clean, also. Remember that in opengl you have only 8 lights active at the same time.

ciacio

I’ve noticed that adding a light in the hidden layer light the bullet as if light is coming from the negative x direction, regardless how I set up the light source.

Any other clue?

c.

Duplicate all of your lights in the main scene and then move the duplicated ones (M) to the layer your bullet is in. Then it will have the same lighting.

Pooba

No. That doesn’t work. Light comes from left (-x) regardless its position.

Try it.

But I’ve solved using a simple python script:

I added a script associated with a controller on the light on the first layer, changing the layer bitmask to 3, in order to light object in the first and second layer (that contains the bullet).

That’s to show that there are features that you can’t access through the interface, but only with python scripting.

The layer button on the lamp settings only affect rendering and not the realtime engine.

Thanks for your answers. This forum works, definitely.

ciacio

c.

Hi @,
what is that exactly a layer bitmask
can you provide some sample code
in what module can I find a function to modify it?
thx

rompelstilc,

I wrote a short tutorial on this:

http://www.poeticstudios.com/blender1.htm

Just for your own clarification…if you want your 1 light that you created in layer1 to cast light on a different layer, select that light and then go into the object buttons(F7). Where you see the tab “Draw” shift click whichever layer it is you wish to cast the light on. This will allow that 1 light to cast the same light on the seperate layers.

thx for the tips
cool