Game Development Community

Crashing when mouse wheel rolls

by Christos Karapiperis · in Torque Game Builder · 10/19/2006 (6:11 am) · 8 replies

Hi,
I do this:

moveMap.bindCmd(mouse0, "zaxis", "DoIt();", "");

and the program crashes. Even if I write it this way:

moveMap.bindCmd(mouse0, zaxis, DoIt(), 0);

the program crashes again. What's wrong with that?


Thanks in advance.

#1
10/21/2006 (2:20 pm)
I think you should look at TDN and leard how to use mouse event
tdn.garagegames.com/wiki/TGB/MiniTutorials/ObjectMouseEvents
#2
10/23/2006 (6:11 am)
Thanks for the answer but I already know how mouse events work. In fact I am already using mouse events the way the above tutorial shows. What I really need is rotate an object using the mouse wheel. If anyone know how I am supposed to do that, I should be very grateful.
Thanks.
#3
10/23/2006 (10:02 pm)
You probably need to remove the parentheses from your function name:

moveMap.bindCmd(mouse0, zaxis, DoIt, 0);

or just:

moveMap.bind(mouse0, zaxis, DoIt);
#4
10/30/2006 (6:18 am)
It happens the same thing either I use parentheses or not. The application crashes. What could be wrong? Isn't there a way to use the mouse wheel?
Thanks.
#5
10/30/2006 (10:29 am)
Are you positive the crash isnt happening in the called function? I'm using the mousewheel to zoom in and out in my prototype, without any sort of problems.

Why don't you post up the function that is getting called?
#6
11/01/2006 (4:52 am)
I call a function which checks if there is an object selected. If there is an object selected, I am just rotating it.
The function I call is this:

function rotateRight()
{
// Check if we have a selected object
if(SceneWindow2D.objectSelected)
{
// Get this object
%obj = SceneWindow2D.selectedObj;

// Get its rotation
%rotation = %obj.getRotation();

// Calculate new rotation
%newRot = ((%rotation / 20) * 20) + 20;

// Set it
%obj.setRotation(%newRot);
}
}

If you have something in your mind, I would be glad to hear it.
Thanks
#7
11/01/2006 (4:54 am)
I call a function which checks if there is an object selected. If there is an object selected, I am just rotating it.
The function I call is this:

function rotateRight()
{
// Check if we have a selected object
if(SceneWindow2D.objectSelected)
{
// Get this object
%obj = SceneWindow2D.selectedObj;

// Get its rotation
%rotation = %obj.getRotation();

// Calculate new rotation
%newRot = ((%rotation / 20) * 20) + 20;

// Set it
%obj.setRotation(%newRot);
}
}

If you have something in your mind, I would be glad to hear it.
Thanks
#8
11/01/2006 (5:02 am)
I call a function which checks if there is an object selected. If there is an object selected, I am just rotating it.
The function I call is this:

function rotateRight()
{
// Check if we have a selected object
if(SceneWindow2D.objectSelected)
{
// Get this object
%obj = SceneWindow2D.selectedObj;

// Get its rotation
%rotation = %obj.getRotation();

// Calculate new rotation
%newRot = ((%rotation / 20) * 20) + 20;

// Set it
%obj.setRotation(%newRot);
}
}

If you have something in your mind, I would be glad to hear it.
Thanks