Game Development Community

Mouse Binds Issue

by Dave Forhan · in Torque Game Builder · 06/16/2008 (5:02 pm) · 4 replies

So its possible I'm just being really dumb, but I can't seem to get mouse axes to bind to functions.
i.e. with

moveMap.bind("mouse0", "xaxis", x_function)
moveMap.bind("mouse0", "yaxis", y_function)

x_function and y_function are never called.


What am I missing here? Why isn't this working for me?

#1
06/19/2008 (4:47 am)
Try globalactionmap instead of moveMap. Maybe that's it.
#2
06/19/2008 (8:03 am)
I've tried GlobalActionMap, and still get nothing. I've tried activating/de-activating the mouse, hiding/unhiding the cursor, locking/unlocking the mouse, etc. When I try binding mouse axes to GlobalActionMap (or moveMap), I can even get a proper callback, i.e.

GlobalActionMap.getCommand("mouse0","xaxis") will return "x_function,"

but for some reason, x_function is never called, and for my test cases, I'm using really simple stuff like

function x_function(%var)
{
$testXVar = %var;
}

and checking the value of $testXVar later (it never changes from its initialization value of zero, ever).

My thought is that the Cursor/Canvas (or some other process/object) is intercepting and processing my mouse move events before they get to the GlobalActionMap - though I haven't walked through the source enough to know for sure.

Thanks for the response though, Ben - Just out of curiosity, is Mouse Axis binding working for you in TGB 1.7.2? From the information I've gathered so far, I sort of get the idea that its something that isn't supported anymore (because almost everything you could do with mouse binding, you can do with other mouse callbacks in a quicker and more accurate way).

The only people who would even notice broken mouse binds are chumps like me who are trying to use multiple mouse objects/devices ;)

Of course, I'd appreciate some sort of confirmation/refutation of this, but this is currently the assumption I'm operating under.
#3
06/19/2008 (9:53 am)
I think you're right (no mouse binding support anymore) as I couldn't manually bind mouse button either (I had to use the integrated callbacks, mousedown, etc.).

But the callbacks are incomplete, for instance I can't bind the middle mouse button anymore :/
#4
06/20/2008 (8:31 am)
Most likely the canvas ( and your guis ) are consuming the mouse input. You may have to set your gui field noCursor = true before any actionmap binds will get any input.

I doubt anything is "broken". Its just that the system isn't designed to allow mouse binds and a gui that handles input at the same time.

Alternatively there is a onMouseMoved callback for some guiControls.