AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Moving the endpoint of a traceray back along it slightly? (https://forums.alliedmods.net/showthread.php?t=77854)

Spazman0 09-22-2008 05:08

Moving the endpoint of a traceray back along it slightly?
 
Alright so this is for my teleport command, which a few people are running.

I am trying to implement the ability to not get stuck in walls when you are aiming at one, but I'm not sure how to go about it.

This is what I have at the moment:
PHP Code:

    decl Float:vAngles[3];
    
decl Float:vOrigin[3];    
    
    
GetClientEyePosition(client,vOrigin);
    
GetClientEyeAngles(clientvAngles);
    
    
//get endpoint for teleport
    
new Handle:trace TR_TraceRayFilterEx(vOriginvAnglesMASK_SHOTRayType_InfiniteTraceEntityFilterPlayer);
        
    if(
TR_DidHit(trace))
    {        
            
TR_GetEndPosition(g_postrace);
            
            
g_pos[2] += 10.0;    
    }
    else
    {
        
PrintToChat(client"[SM] %s""Could not teleport player");
        
CloseHandle(trace);
        return 
false;
    }
    
    
CloseHandle(trace);
    return 
true

I am assuming I will have to use GetVectorDistance(vOrigin,g_pos), subtract a bit off it, and then combine that with the view angles to somehow get the end point.

Any help would be muchly appreciated.


All times are GMT -4. The time now is 04:43.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.