Game Development Community

View Distance for Options GUI 1.8.1

by Bryce² · 08/02/2009 (6:06 am) · 6 comments

Just a quick note.
--You MUST call your sky, skyObject and the slider, vDistance.
--I made this in afx but will still go into Stock 1.8.1


ok add this to your terrain/sky.cpp around line 278
ConsoleMethod( Sky, updateVisibility, void, 2, 2, "...")  
{  
   object->updateVisibility();  
}

Then add this to your optionsDlg.cs.
function OptionsDlg::visibleDistanceSlider(%this)
{
	skyObject.visibleDistance = vDistance.value;
	skyObject.updateVisibility();
};

Then in the at the end of the optionsDlg.gui add this.
new GuiSliderCtrl(vDistance) {
            canSaveDynamicFields = "0";
            Enabled = "1";
            isContainer = "0";
            HorizSizing = "right";
            VertSizing = "bottom";
            position = "272 88";
            Extent = "64 24";
            MinExtent = "8 2";
            canSave = "1";
            Visible = "1";
            Variable = "value";
            AltCommand = "optionsDlg.visibleDistanceSlider();";
            hovertime = "1000";
            range = "200 3e+003";
            ticks = "2800";
            value = "200";
         };

And that should be it. Compile and Run. Just be aware that the slider position is probably in a dumb spot as my options are customized.

If you want fog to draw as well add this to your function
skyObject.fogDistance = vDistanceValue + 50;

About the author

Nimansoft, http://www.nimansoft.com/


#1
08/02/2009 (6:24 am)
Works like a charm in stock TGEA 1.8.1. Thanks! ;)
#2
08/02/2009 (9:25 pm)
Great idea, and it should work in TGE as well... I'm not in a position to test it, but unless the SKy object has been changed drastically for TGEA...?
#3
08/02/2009 (10:12 pm)
Nice idea.

Just a heads up: this will not work in Torque 3D. Visibility is no longer associated with a sky object.
#4
08/03/2009 (1:05 am)
Thanks for the heads up Michael, i changed the description.
#5
01/11/2010 (12:02 pm)
What needs to be done to get this to work under T3D? (As there are multiple sky options now...)
#6
01/11/2010 (6:11 pm)
The visibility isn't even controlled via sky anymore, like Mich said.

You would need to make all of this work under the MissionInfo.