Game Development Community

Dynamic .DTS shadows

by Lorenz Golard · in Torque Game Engine · 04/20/2005 (7:57 am) · 4 replies

Hi!
How to turn on dynamic shadows for DTS shapes? I am trying to add a dynamic shadow to a StaticShapeData datablock (the switch from the scripting tutorial in the documentation), but I didn't find anything in the datablock documentation.

#1
04/20/2005 (3:23 pm)
They are mostly on by default, at least for some object types. I don't believe StaticShape is one of those, though I could be wrong. Try using a Player or Item.
#2
04/21/2005 (8:19 am)
Items don't have shadows. I'm not able to get it to work as a Player (it doesn't show up).
Item code:
datablock ItemData(Switch)
{
   category = "Misc";
   shapeFile = "./flagpole.dts";

   isSwitchOn = false;
};

function Switch::onCollision(%this,%obj,%col,%pos)
{
   if(%obj.isSwitchOn)
   {
      %obj.stopThread(0);
      %obj.isSwitchOn = false;
   }
   else
   {
      %obj.playThread(0,"ambient");
      %obj.isSwitchOn = true;
   }
}
#3
04/21/2005 (4:49 pm)
Try to check in your /client/default.cs if you have a line like this :

$pref::shadows = "2";

Since it affects the quality of the shadows if you have it set to 0 or 1 you might not be able to see them at all.

Hope it helps.
#4
04/22/2005 (6:17 am)
$pref::shadows is already set to 2. I've enabled item shadows in the c code (lighting pack, not torque only) by changing item.cc.

old:
Item::Item()
{
   mTypeMask |= ItemObjectType;
   mDataBlock = 0;
   mCollideable = false;
   mStatic = false;
   mRotate = false;
   mVelocity = VectorF(0,0,0);
   mAtRest = true;
   mAtRestCounter = 0;
   mInLiquid = false;
   delta.warpTicks = 0;
   delta.dt = 1;
   mCollisionObject = 0;
   mCollisionTimeout = 0;
   //mGenerateShadow = true;

   mConvex.init(this);
   mWorkingQueryBox.min.set(-1e9, -1e9, -1e9);
   mWorkingQueryBox.max.set(-1e9, -1e9, -1e9);
}

new:
Item::Item()
{
   mTypeMask |= ItemObjectType;
   mDataBlock = 0;
   mCollideable = false;
   mStatic = false;
   mRotate = false;
   mVelocity = VectorF(0,0,0);
   mAtRest = true;
   mAtRestCounter = 0;
   mInLiquid = false;
   delta.warpTicks = 0;
   delta.dt = 1;
   mCollisionObject = 0;
   mCollisionTimeout = 0;
   mGenerateShadow = true;//!

   mConvex.init(this);
   mWorkingQueryBox.min.set(-1e9, -1e9, -1e9);
   mWorkingQueryBox.max.set(-1e9, -1e9, -1e9);
}
But the shadow isn't animated and it doesn't rotate (the ammo item shadows aren't rotating, but the ammo items are).