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

World boundaries and TR_PointOutsideWorld()


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 06-10-2021 , 04:11   World boundaries and TR_PointOutsideWorld()
Reply With Quote #1

Hi,

why TR_PointOutsideWorld() Y != m_WorldMaxs' Y on some maps?

On other maps they almost match (~ 0.1 diff.)

I'm executing the following code (when I located on open-air):

PHP Code:
#pragma semicolon 1
#pragma newdecls required

#include <sourcemod>
#include <sdktools>

public void OnPluginStart()
{
    
RegAdminCmd("sm_b"CmdBADMFLAG_ROOT"");
}

public 
Action CmdB(int clientint args)
{
    
float vLoc[3], end[3];
    
GetClientAbsOrigin(clientvLoc);
    
    
// Get Sky position (if we're on open-air)
    
    
if( Trace_GetRoof(vLocend))
    {
        
PrintToChatAll("Sky: Y = %f"end[2]);
        
        
// check those function with a point +10.0 higher and -10.0
        
end[2] -= 10.0;
        
PrintToChatAll("TR_PointOutsideWorld? (%f) = %b"end[2], TR_PointOutsideWorld(end));
        
end[2] += 20.0;
        
PrintToChatAll("TR_PointOutsideWorld? (%f) = %b"end[2], TR_PointOutsideWorld(end));
        
        
// now, compare with the world
        
float min[3], max[3], pos[3];
        
        
GetEntPropVector(0Prop_Data"m_WorldMins"min);
        
GetEntPropVector(0Prop_Data"m_WorldMaxs"max);
        
GetEntPropVector(0Prop_Data"m_vecOrigin"pos);
        
        
AddVectors(minposmin);
        
AddVectors(maxposmax);
        
        
PrintToChatAll("world ori: %f %f %f"pos[0], pos[1], pos[2]);
        
PrintToChatAll("world min: %f %f %f"min[0], min[1], min[2]);
        
PrintToChatAll("world max: %f %f %f"max[0], max[1], max[2]);
    }
    return 
Plugin_Handled;
}

stock bool Trace_GetRoof(float vecOrigin[3], float vecRoof[3])
{
    
bool bFound;
    
Handle hTrace TR_TraceRayFilterEx(vecOriginview_as<float>({-90.00.00.0}), MASK_VISIBLERayType_InfiniteTraceRayNoPlayers);
    if (
hTrace != INVALID_HANDLE)
    {
        if (
TR_DidHit(hTrace))
        {
            
TR_GetEndPosition(vecRoofhTrace);
            
bFound true;
        }
        
delete hTrace;
    }
    return 
bFound;
}

public 
bool TraceRayNoPlayers(int entityint mask)
{
    if(
<= entity <= MaxClients)
    {
        return 
false;
    }
    return 
true;

Result:
Quote:
Sky: Y = 1919.968872
TR_PointOutsideWorld? (1909.968872) = 0
TR_PointOutsideWorld? (1929.968872) = 1

world ori: 0.000000 0.000000 0.000000
world min: -256.000000 -2224.000000 -360.000000
world max: 4896.000000 6656.000000 1436.000000
1919 != 1436
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]

Last edited by Dragokas; 06-10-2021 at 04:13.
Dragokas 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 05:25.


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