Lights, rooms and character (problem)

Hello everyone,

I’m blocking on a light management problem. Let me explain:

In the game, the level is composed of different rooms, lights are arranged in some rooms

For a light in a room does not influence a room or a corridor nearby, each room is a child node that is added to rootNode. (to prevent the light from crossing a wall since the light will influence only the sub-graph for which it is associated)

but:

When a character moves between different rooms and corridors, I would like the lights to affect the character as well. But since the character is not part of the subgraphs of the different rooms, he is never enlightened.

How could I solve this problem?

Thank you

1 Like

Can you move the character to the sub-graph?

1 Like

yes I can move it but that would mean that the character must each time be moved from one subgraph to another when it changes room.

I could actually test in an appstate if the character is in a subgraph and add it when it enters but I wonder if there would not be another solution

1 Like

Can you put the player into a separate sub-graph(player only) with copy of the lights affecting him?

1 Like

Is there a reason that you can’t add the lights to the player as he enters the room and then remove them again when he leaves?

Put the character in the room. That’s where he is. It makes sense. You moved everything else anyway. Why leave out the char? You even have the room object.

I think I’m going to copy the lights in a subfile dedicated to the characters or add a light to the character when it enters the room (even if this second solution will certainly pose graphic problems, there is a risk of an inconsistency if the lights of different colors are too close together).

I test and I give you the result.

Thanks

JME and AppStates have the event loop so you can move a character between frames to wherever you want. Are you afraid that if you make a copy of the character, it will loose it’s soul? It’s pass by ref. The soul will go along with it. (I’m chuckling to myself. I started playing LOTRO - an MMORPG - and was afraid that I could do something that would permanently kill (delete) my character. I didn’t want to swim in a virtual lake, cause I thought a virtual sea monster would eat me and delete my toon.)
Go ahead, beam him down.