Game Development Community

Mouse, bind and x(y)axis

by Thomas Bang · in Torque Game Engine · 01/13/2009 (11:48 am) · 3 replies

Hi

I have a little problem with mouse bindings. The code looks like this...

if (isObject(am_player))
   {
      am_player.delete();
   }
   
   Canvas.hideCursor();
   Canvas.CursorOn();
   enableMouse();
   
   new ActionMap(am_player); 

   
   am_player.bind( keyboard, w, playerMoveForward );
   am_player.bind( keyboard, s, playerMoveBackward );
   am_player.bind( keyboard, a, playerMoveLeft );
   am_player.bind( keyboard, d, playerMoveRight );
   
   am_player.bind(mouse0, xaxis, yaw);
   am_player.bind(mouse0, yaxis, pitch);
  
   am_player.push();

   function yaw(%val)
   {
      $mvYaw += getMouseAdjustAmount(%val);
      echo("YAW executed");
   }

   function pitch(%val)
   {
      $mvPitch += getMouseAdjustAmount(%val);
      echo("PITCH executed");
   }

When i move the mouse the two strings "YAW executed" and "PITCH executed" should be in the console.
I looked at the scripts from starter.fps but there is no difference to my script.

Is there a problem with xaxis and yaxis? Whats wrong?

#1
01/14/2009 (4:08 am)
Problem solved.
#2
04/16/2009 (9:02 am)
Thomas, what was the solution? I have almost the identical problem.
#3
04/16/2009 (12:07 pm)
Sorry... unfortunately i cant remember.