Game Development Community

Help with Tactics-Action Hybrid Tutorial

by none · in Torque 3D Beginner · 10/19/2012 (8:57 am) · 7 replies

Hi everyone! I've been following this tutorial made by Steve - www.garagegames.com/community/resources/view/20998 and everything works great so far like it is supposed to, but I noticed because I made my own level rather than the one in the tutorial, that the player you control can only be told to move on terrain. When I click on a shape or even the blank room mission it says out of range. Anyone know how to change this so I can have my character move into interiors and shapes? Thanks!

#1
10/19/2012 (1:27 pm)
Just add staticObjectType as a typemask for the mouse click raycast so it can detect dts objects/models as well as the terrain.

Also note that staticTSobjectType has been replaced by this in T3D 1.2.
#2
10/19/2012 (1:35 pm)
Quick moderator note. I updated the url in the OP so it wouldn't point to a non-existent resource.
#3
10/19/2012 (2:44 pm)
Thanks Steve! Also thanks Scott, didn't catch that!
#4
10/19/2012 (4:10 pm)
%searchMasks = $TypeMasks::TerrainObjectType;  
  
        // search!  
        %scanTarg = ContainerRayCast( %start, %end, %searchMasks );  
     
        // If the terrain object was found in the scan  
        if( %scanTarg )  
        {  
            // Get the X,Y,Z position of where we clicked  
            %pos = getWords(%scanTarg, 1, 3);  
        
            // Get the normal of the location we clicked on  
            %norm = getWords(%scanTarg, 4, 6);  
              
            //if we are not moving already, start to deplete energy/action points  
            if(%ai.getVelocity() $="0 0 0")  
                %ai.schedule(500, "decEnergy");  
  
            // Set the destination for the AI player  
            %ai.setMoveDestination( %pos );  
              
            //clear his aim so he looks where he is running  
            %ai.clearAim();  
          
            // If the AI player already has a decal (0 or greater)  
            // tell the decal manager to delete the instance of the gg_decal  
            if( %ai.decal > -1 )  
            {  
                decalManagerRemoveDecal( %ai.decal );  
          
                if(%ai.getVelocity() !$="0 0 0")  
                {  
                    %ai.stop();  
                    return;  
                }  
            }

I know that I need to add it in here, but I keep running into scripting errors, thanks for all of the help!
#5
10/19/2012 (5:18 pm)
%searchMasks = $TypeMasks::TerrainObjectType | $TypeMasks::StaticObjectType;
#6
10/19/2012 (6:34 pm)
Hmm Steve I plugged this in but still when I move the aiplayer on a dts it only receives the move position underneath on the terrain so its not actually moving according to the place I clicked on the shape. Im using the stock station asset.
#7
11/04/2012 (6:25 pm)
Are the DTS objects walk-able? with collisions, etc?

perhaps your click goes right through, to the terrain -- try setting the collision to visible or such.