Game Development Community

Dynamic lighting on DTS objects (TLK)

by Aaron Clifford · in Torque Game Engine · 08/30/2006 (3:08 pm) · 9 replies

Hey, I've just started using the Torque Lighting Kit and I've run into a bit of a brick wall..

I want a selected mesh to cast a dynamic shadow, like the Torque logo item for instance, here's a pic of my test:

i17.photobucket.com/albums/b81/pankake2005/Misc/example.jpg
As you can see I'veplaced a couple of my meshes I want to cast a dynamic shadow, the Torque logo item which casts one perfectly and a dynamic light, and the sun also.

I've seen it can be done in the TLK 'ModelersGuide.pdf' I've checked all the options in static mesh's inspector properties, nothing about casting dynamic shadows, so I was thinking, the torque logo item must have a script file somewhere that categorises it as a 'shape' and not a 'static shape', so where do I go from here? I've had a look through all the directories for the logo item script file to no avail, I have a non-source code build and I'm not a programmer so please don't tell me I haveto change source code :/.

PS, sorry if this is in the wrong section.

#1
09/01/2006 (10:57 am)
Never mind, programmer sorted it :).
#2
09/01/2006 (11:02 am)
Cool. By the way that screenshot looks of quite high quality. Good job. :)
#3
09/01/2006 (11:06 am)
Hehe, thanks, just a little testing ground..
#4
09/01/2006 (8:52 pm)
Arrg. sorry, lots of posts saying the problem was fixed, but no fix posted.
How did you fix this problem??
#5
09/02/2006 (2:30 am)
Ah, you're right, sorry, I'll post the fix soon, gotta' get some breakfast :).
#6
09/02/2006 (3:40 am)
Ok, firstly place the .dts and texture file in the shapes directory where you want for example:
\data\shapes\test\box.dts
Next we need to write a script file for the mesh, so it tells the engine it's not a static shape,
we'll use the 'LogoItem' script file located at:
\yourgame\server\LogoItem.cs
So make a copy of the LogoItem script file and open it up in notepad, change the 'StaticShapeData' name (default: 'TorqueLogoItem) to 'Box' or whatever your model's name is, you can either leave the category as 'Item' or change it, depending on your needs, changing the category will create a new category under the 'shapes' list in the World Editor Creator.

Where it says:
shapeFile = "~/data/shapes/3dtorquelogo/torque_logo.dts";
change the path so it points to your model so it should look like:
shapeFile = "~/data/shapes/test/box.dts";
Ok we're done in there, save and close the file, make sure you name it box.cs (replace 'box' with your model name).

Next we need to tell the engine to load our new script file, or it will be ignored when booting up the engine, here's how:

In:
yourgame\server\game.cs

find:
// Load up all datablocks, objects etc.
   exec("./camera.cs");
   exec("./editor.cs");
   exec("./player.cs");
   exec("./logoitem.cs");

and add your new script file underneath the last, so it should look like:

// Load up all datablocks, objects etc.
   exec("./camera.cs");
   exec("./editor.cs");
   exec("./player.cs");
   exec("./logoitem.cs");
   exec("./box.cs");

That should be it, and your new model will be placed under 'Items' in the World Editor Creator, I hope I haven't missed anything, let mew know...

PS. Thanks to our Client Programmer Aron Bailiss for sorting this out.
#7
09/02/2006 (4:01 am)
Here's the result, left Dynamic, right Lightmap.

i17.photobucket.com/albums/b81/pankake2005/Enviroment_work/shadow_testsmall.jpg
#8
09/02/2006 (6:35 am)
Thankyou for showing how you fixed this. :)
That pic is great. :)
#9
09/02/2006 (6:42 am)
No problem, thank you.