Lock Mouse Look - Code
by Jared Schnelle · in Torque Game Engine · 12/13/2002 (12:20 pm) · 0 replies
I'm only posting this because it's so darn easy, and it's something I've seen a few people request in other threads.
The code assumes you're using a mouse pointer all the time.
Make a function:
You'll need to add the moveMap.bind to default.bind.cs and probably config.cs
That's it, heh, easy enough. This is bound to the mouse wheel button depressed. I have something else using right mouse click, but if you want it to use your rightmouse, then use "button1".
While I'm here messing with the way you look around using the mouse, I changed the functionality of another function, take a look at:
In the base SDK, you have to hold Z down to do freelook, this just makes it toggleable.
Ok, back to work :)
The code assumes you're using a mouse pointer all the time.
Make a function:
function lockMouseLook(%val)
{
if(%val)
CursorOff();
else
CursorOn();
}
moveMap.bind(mouse0, "button2", lockMouseLook);You'll need to add the moveMap.bind to default.bind.cs and probably config.cs
That's it, heh, easy enough. This is bound to the mouse wheel button depressed. I have something else using right mouse click, but if you want it to use your rightmouse, then use "button1".
While I'm here messing with the way you look around using the mouse, I changed the functionality of another function, take a look at:
function toggleFreeLook(%val)
{
if (%val)
{
$mvFreeLook = !$mvFreeLook; // true;
}
}
moveMap.bind(keyboard, z, toggleFreeLook);In the base SDK, you have to hold Z down to do freelook, this just makes it toggleable.
Ok, back to work :)
About the author