anyone have Click RPG style movement tutorial?
by Enel · in Torque 3D Professional · 02/03/2010 (4:10 am) · 3 replies
i have make like this..
but it isnt work when i control Player character..
anyone have rpgstyle movement tutorial?..
function serverCmdTarget(%client, %mouseVec, %cameraPoint)
{
echo("pos: ", %cameraPoint);
echo("vec: ", %mouseVec);
//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);
// if we didn't get interior, then try terrain
if(!$obstruction)
{
//%scanTarg = ContainerRayCast (%cameraPoint, %rangeEnd, %SecondSearchMask);
%scanTarg = ContainerRayCast (%cameraPoint, %rangeEnd, %SecondSearchMask);
}
// a target in range was found so select it
if (%scanTarg)
{
%targetObject = getWords(%scanTarg,1,3);
%client.player.setMoveDestination(%targetObject);
}
}but it isnt work when i control Player character..
anyone have rpgstyle movement tutorial?..
About the author
Torque 3D Owner TSI Gamer
http://docs.torquepowered.com/torque-3d/official/
and looking for RTS prototype.