Raised This Month: $51 Target: $400
 12% 

Moving the endpoint of a traceray back along it slightly?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Spazman0
Member
Join Date: Jul 2008
Old 09-22-2008 , 05:08   Moving the endpoint of a traceray back along it slightly?
Reply With Quote #1

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.
Spazman0 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:06.


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