Game Development Community

dev|Pro Game Development Curriculum

Invert Mouse - T3D

by Glenn Bermingham · 01/08/2014 (9:06 am) · 3 comments

Kudos www.garagegames.com/community/resources/view/2180
Every game needs a mouse invert for those crazy people. This is just an updated version of the link above for Torque 3D.

Part A

Find:
art/gui/optionsDlg.gui
new GuiSliderCtrl(OptMouseSensitivity) {  
            range = "0.02 2";  
            ticks = "10";  
            value = "0.75";  
            isContainer = "0";  
            Profile = "GuiSliderProfile";  
            HorizSizing = "right";  
            VertSizing = "bottom";  
            position = "105 182";  
            Extent = "244 18";  
            MinExtent = "8 2";  
            canSave = "1";  
            Visible = "1";  
            Command = "OptMouseSetSensitivity(OptMouseSensitivity.value);";  
            tooltipprofile = "GuiToolTipProfile";  
            hovertime = "1000";  
            canSaveDynamicFields = "0";  
         };
Change to:
new GuiSliderCtrl(OptMouseSensitivity) {  
            range = "0.02 2";  
            ticks = "10";  
            value = "0.75";  
            isContainer = "0";  
            Profile = "GuiSliderProfile";  
            HorizSizing = "right";  
            VertSizing = "bottom";  
            position = "105 182";  
            Extent = "152 18";  //Changed
            MinExtent = "8 2";  
            canSave = "1";  
            Visible = "1";  
            Command = "OptMouseSetSensitivity(OptMouseSensitivity.value);";  
            tooltipprofile = "GuiToolTipProfile";  
            hovertime = "1000";  
            canSaveDynamicFields = "0";  
         };
Now add after that code:
new GuiCheckBoxCtrl() {
            text = "Invert Mouse";
            groupNum = "-1";
            buttonType = "ToggleButton";
            useMouseEvents = "0";
            position = "267 183";
            extent = "80 16";
            minExtent = "8 2";
            horizSizing = "right";
            vertSizing = "bottom";
            profile = "GuiCheckBoxProfile";
            visible = "1";
            active = "1";
            variable = "$pref::Input::MouseInvert";
            tooltipProfile = "GuiToolTipProfile";
            hovertime = "1000";
            isContainer = "0";
            canSave = "1";
            canSaveDynamicFields = "0";
         };

Part A Done
Now load up your game and check the control tab in Options, should now have a slightly smaller mouse sensitivity bar and a Invert Mouse button.

Part B

Find:
scripts/client/default.bind.cs
function pitch(%val)
{
   %pitchAdj = getMouseAdjustAmount(%val);
   if(ServerConnection.isControlObjectRotDampedCamera())
   {
      // Clamp and scale
      %pitchAdj = mClamp(%pitchAdj, -m2Pi()+0.01, m2Pi()-0.01);
      %pitchAdj *= 0.5;
   }

   $mvPitch += %pitchAdj;
}
Change to:
function pitch(%val)
{
//Changes start
   //%pitchAdj = getMouseAdjustAmount(%val); //Don't need this anymore
   
   if($Pref::Input::MouseInvert)
   {
      %pitchAdj -= getMouseAdjustAmount(%val);
   }
   else
   {
       %pitchAdj += getMouseAdjustAmount(%val);
   }
//Changes end
   
   if(ServerConnection.isControlObjectRotDampedCamera())
   {
      // Clamp and scale
      %pitchAdj = mClamp(%pitchAdj, -m2Pi()+0.01, m2Pi()-0.01);
      %pitchAdj *= 0.5;
   }

   $mvPitch += %pitchAdj;
}

Then go to and add:

core/scripts/client/defaults.cs
$pref::Input::MouseInvert = 0;

After
$pref::Input::LinkMouseSensitivity = 1;

Just to reset the default to 0 rather than nothing.

Part B Done

Now load up a level in your game; Go into the options (Ctrl+O) and give it a try.

Now you've satisfied a group of people with strange habits.

#1
01/08/2014 (11:15 am)
Quote:
Every game needs a mouse invert for those crazy people.
Testify, brother! ;)
#2
01/08/2014 (3:17 pm)
hah great idea :D
#3
02/17/2014 (4:30 pm)
Thank you so much. I am one of those crazy people.