Game Development Community

mouse click dosent work

by Enel · in Torque 3D Professional · 02/02/2010 (10:52 pm) · 0 replies

first question. right click dosent work.. when showing cursor

in default.bind.cs

function altTrigger(%val)
{    
    if(%val)
        hidecursor();
    else
        showcursor();
}
moveMap.bind( mouse, button1, altTrigger );

in config.cs
moveMap.bind(mouse0,  "button1", altTrigger );

and...

second question player dosent move when player is 'setControlObject'
function serverCmdTarget(%client, %mouseVec, %cameraPoint)
{   
   echo("pos: ", %cameraPoint);   
   echo("vec: ", %mouseVec);   
   //theEgg.setMoveDestination(%pos);   
      
   //Determine how far should the picking ray extend into the world?   
   %selectRange = 200;   
  
   // scale mouseVec to the range the player is able to select with mouse   
   %mouseScaled = VectorScale(%mouseVec, %selectRange);   
      
   // cameraPoint = the world position of the camera   
   // rangeEnd = camera point + length of selectable range   
   %rangeEnd = VectorAdd(%cameraPoint, %mouseScaled);   
   %FirstSearchMask = $TypeMasks::InteriorObjectType;   
   %SecondSearchMask = $TypeMasks::TerrainObjectType;   
      
   // Search for objects within the range that fit the masks above. If we are   
   // in first person mode, we make sure player is not selectable by setting   
   // fourth parameter (exempt from collisions) when calling ContainerRayCast   
   $obstruction = ContainerRayCast (%cameraPoint, %rangeEnd, %FirstSearchMask);   
   //$obstruction = ContainerRayCast (%pos, %rangeEnd, %SecondSearchMask);   
   echo("obstruction: ", $obstruction);   
      
   // if we didn't get interior, then try terrain   
   if(!$obstruction)   
   {   
      //%scanTarg = ContainerRayCast (%cameraPoint, %rangeEnd, %SecondSearchMask);   
      %scanTarg = ContainerRayCast (%cameraPoint, %rangeEnd, %SecondSearchMask);   
      echo("scanTarg: ", %scanTarg);   
   }   
      
   // a target in range was found so select it   
  
   if (%scanTarg)   
   {   
      echo("scanTarg");   
      %targetObject = getWords(%scanTarg,1,3);   
      echo("targetObject: ", %targetObject);   
  
      //%target = %client.ResolveGhost(%ghost);   
  
      //AIManager.MovePlayer(%target, %targetobject);   
      //theEgg.SetMoveDestination(%moveto);    
      %client.player.setMoveDestination(%targetObject);   
   }   
}