Game Development Community

Mouse controll

by Anthony Merlo · in Torque Game Engine · 01/23/2009 (7:05 pm) · 4 replies

I recently purchased TGEA and have been having some problems trying to figure out how to so something that would seem trivial.

I have a question before that though.

After purchasing I was offered the opportunity to download what looked like 3 different versions of the software. Ver 1.7.0, Ver 1.7.1 and Ver 1.8.0. Which of these should I be using? I downloaded all 3 because the link was only good for 15 minutes so I figured I should get them all.

Back to my question. The game defaults with mouselook constantly on. What I want to do is make the right button mouselook insted of the jetpack thing it does now. Problem is I can't figure out where this code is located.

I did figure out where to turn the mouselook off in the noCursor option. Just need to know where the jetpack code is and what command I need to change it to activate mouselook when it's pressed.

Thanks!


#1
01/23/2009 (7:31 pm)
Quote:Which of these should I be using?
1.7.1 is an update (bug fix) of 1.7.0
1.8.0 is the newest version so I would use that, unless you want to use a heightmap to make your terrain. If you do, use 1.7.1 to make your terrain then import it into 1.8.0

Quote:Problem is I can't figure out where this code is located.

Take a look in:
Game/ScriptsAndAssets/Client/Scripts/defaultBind.cs

These are the mouse binds. Remove them to remove free looking with the mouse.
moveMap.bind( mouse, xaxis, yaw );
moveMap.bind( mouse, yaxis, pitch );

I don't know where the jetpack code is.

#2
01/23/2009 (9:40 pm)
I found where it is. function altTrigger(%val)

The problem is making it so that turns mouselook on.

I tied this:

if ( %val )
{ lockMouse(true);

}
else
{ lockMouse(false);

}

and it doesn't work quite right. I have a pointer when I let go of the right mouse button, but it also moves the view.
#3
01/24/2009 (6:58 am)
I just noticed hitting the z key to toggle free look doesn't even work in the original program.

function toggleFreeLook( %val )
{
   if ( %val )
      $mvFreeLook = true;
      
   else
      $mvFreeLook = false;
}

moveMap.bind( keyboard, z, toggleFreeLook );

This is getting frustrating. It's almost like there isn't a way to toggle out of free look so you can click on buttons on the gui.
#4
02/01/2009 (6:16 pm)
I still can't figure this out.

I can get it to work with mouselook when I hold the right mouse button but with problems.

This is what I'm putting in my default.bind.cs:

function altTrigger(%val)
{
   if (%val)
   {
      lockMouse(true);
      Canvas.cursorOff();
      
   }
   else
   {
      lockMouse(false);
      Canvas.cursorOn();
      
   }
}

moveMap.bind( mouse, button0, mouseFire );
moveMap.bind( mouse, button1, altTrigger );

With the noCursor set to 1 I start in mouselook mode and when I press the right mouse button it goes into cursor mode and won't respond to any mouse clicks.

With the noCursor set to 0 it starts with a cursor and it doesn't respond to any mouse clicks.

If I bind it to a key using moveMap.bind( keyboard, m, altTrigger ); it works, but I still have no response to mouse clicks in cursor mode. I have to hold the "m" key to be able to use the mouse buttons.

the only way I can use the mouse like the "m" key bind is if I set the bind using GlobalActionMap.bind( mouse, button1, altTrigger );. But then I'm in the same situation. I have to hold the right mouse button to be able to use the left mouse button.

And if I set the left mouse button using GlobalActionMap.bind( mouse, button0, mouseFire ); then I won't be able to use the mouse to click on any menu options.

This is driving me nuts. All I want to be able to do is click on things like Dave Myers shows in his resource (Object selection in Torque (v1.2 onward)) but of course that doesn't work anymore and no one has updated a version of that resource for 1.8.

I don't even need it to high lite it or show a bounding box. Just echo the the console that I clicked on something and I can take it from there.

It's almost like when I go out of mouselook mode it's using a completely different mouse bind somewhere else in he program.

If someone can help me out that would be great. I tried to figure it out on my own, but I'm just spinning my wheels here.

Thanks.