Using left mouse to toggle cursor doesn't work.
by Anthony Merlo · in Torque 3D Professional · 04/14/2011 (8:45 am) · 3 replies
This is driving me nuts because I remember getting this to work a long time ago using TGEA. Now I can't for the life of me remember how I did it so I can do it in T3D.
What I'm trying to do is have the cursor visible on startup, when the left mouse is held down the cursor disappears and you can control the player. Let go of the mouse and you stop controlling the player and the cursor reappears so you can click on object in the game environment.
I tried the obvious approach in default.bind.cs:
Using the "m" key works exactly how I want it to. The mouse button doesn't do anything.
It must have something to do with disabling control to the canvas when the cursor is visible but I have no idea why or how to fix it.
I hope someone can help me out with this. Thanks!
What I'm trying to do is have the cursor visible on startup, when the left mouse is held down the cursor disappears and you can control the player. Let go of the mouse and you stop controlling the player and the cursor reappears so you can click on object in the game environment.
I tried the obvious approach in default.bind.cs:
showCursor();
moveMap.bind( mouse, button0, toggleMouselook);
moveMap.bind(keyboard, "m", toggleMouselook);
function toggleMouselook(%val)
{
$isMouseDown = %val;
if($isMouseDown)
{
hideCursor();
}
else
{
showCursor();
}
}Using the "m" key works exactly how I want it to. The mouse button doesn't do anything.
It must have something to do with disabling control to the canvas when the cursor is visible but I have no idea why or how to fix it.
I hope someone can help me out with this. Thanks!
About the author
#2
04/14/2011 (9:28 am)
Deleted
#3
I posted on that thread too.
EDIT: Never mind. I accidentally had the compiler set to debug and was executing the wrong EXE.
04/14/2011 (11:03 am)
I replied to that thread. I tried David's fix and it does hide the cursor when the mouse button is pressed but it doesn't show the cursor when it's released.I posted on that thread too.
EDIT: Never mind. I accidentally had the compiler set to debug and was executing the wrong EXE.
Torque Owner Enel
ENEL Indie studio
chcek my thread