Game Development Community

Change sky.visibleDistance using scripts

by Leon · in Torque Game Engine · 12/10/2003 (9:03 am) · 2 replies

HOw could i get changed this value? i tried:

Sky.visibleDistance = "50";

but nothing..

thx.

#1
12/10/2003 (9:16 am)
Thats the correct way script wise to set it, but the info is not being passed through the network. You could create a consoleMethod that you could call.

In sky.cc below the other console methods add...
ConsoleMethod( Sky, updateVisibility, void, 2, 2, "...")
{
   object->updateVisibility();
}

Then in scripts just do the following..

sky.visibleDistance = 50;
sky.updateVisibility();

Or in one shot..
//in sky.cc
ConsoleMethod( Sky, updateVisibility, void, 3, 3, "( dist )")
{
   object->setVisibleDistance(dAtof(argv[2]));
}

void Sky::setVisibleDistance(F32 dist)
{
   mVisibleDistance = dist;
   updateVisibility();
}

//in sky.h below ~Sky();
void setVisibleDistance(F32 dist);

Then is scripts..
sky.setVisibleDistance(50);

Thats it.
Sam G
#2
12/10/2003 (9:51 am)
Thank you for the code, ill try it!

Ah, in script code is:
Sky.updateVisibility(number);
since you put ConsoleMethod( Sky, updateVisibility...