About Store Forum Documentation Contact



Post Reply 
light shown in world editor but not in Game
Author Message
andrake Offline
Member

Post: #1
light shown in world editor but not in Game
Hi
i still try to understand how to add light in my Game
now i can add light to world but it not shown in game.
what can be wrong?
i think should be tutorial for adding light
03-09-2015 06:20 AM
Find all posts by this user Quote this message in a reply
Tottel Offline
Member

Post: #2
RE: light shown in world editor but not in Game
There is a tutorial for adding light. smile

First of all, it's important to know that what you place in the editor will not automatically be loaded into your game (only terrain will). This is because you want to have control over how you store it.

So, to load the placed lights into your game, first make a container that will say of which type the lights will be:
Code:
Game.ObjMap<Game.ObjLightCone > ConeLights;
Game.ObjMap<Game.ObjLightPoint> PointLights;

I made 2 containers here, 1 for cone lights, one for point lights. You can place those somewhere at the top in Main

Next, these containers do nothing without us telling the world manager to fill them with all objects that have the proper Object_Class in the editor. So, in Init():

Code:
Game.World.activeRange(D.viewRange())
       .setObjType(PointLights, OBJ_POINT_LIGHT)
       .setObjType(ConeLights, OBJ_CONE_LIGHT)
Game.World.New(UID(2162960215, 1166629077, 880822961, 2503136980));

And that's it, the world manager will now put all objects of these types in the proper containers. Equally important: The world manager will now also update and draw these objects automatically.
03-09-2015 07:29 AM
Find all posts by this user Quote this message in a reply
andrake Offline
Member

Post: #3
RE: light shown in world editor but not in Game
thank Youfor explain, it works

your tutorial should be on main page , writed by BIG text 24 size and highlighted ) thank you again
(This post was last modified: 03-09-2015 02:31 PM by andrake.)
03-09-2015 02:28 PM
Find all posts by this user Quote this message in a reply
Tottel Offline
Member

Post: #4
RE: light shown in world editor but not in Game
You're welcome!

To see more tutorials:
Open the Tutorials project in Esenthel, then type in "light" in the search bar at the top. smile
It's a 1 file project that show how to load lights and particles from the world editor.
03-09-2015 02:50 PM
Find all posts by this user Quote this message in a reply
Post Reply