Raised This Month: $32 Target: $400
 8% 

Get the distance between two different z-axis points


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 02-22-2018 , 00:58   Get the distance between two different z-axis points
Reply With Quote #1

(I've searched thoroughly and found none that provides the answer for this)

Well, SourceMod has GetVectorDistance which gets the distance of two different vectors but is it possible for two different z-axis points?

If so, how to achieve it?
cravenge is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 02-22-2018 , 01:05   Re: Get the distance between two different z-axis points
Reply With Quote #2

Just set x y for both vectors to 0 and check the distance.

Or just minus one z from the other and abs it.
__________________
Neuro Toxin is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 02-22-2018 , 01:46   Re: Get the distance between two different z-axis points
Reply With Quote #3

I will try your suggestions. Thanks!
cravenge is offline
hmmmmm
Great Tester of Whatever
Join Date: Mar 2017
Location: ...
Old 02-22-2018 , 14:23   Re: Get the distance between two different z-axis points
Reply With Quote #4

PHP Code:
float zDist FloatAbsvec1[2] - vec2[2] ); 
hmmmmm is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 02-24-2018 , 07:51   Re: Get the distance between two different z-axis points
Reply With Quote #5

Okay, now that has been taken care of... How to be sure that no entity is blocking the two z-axis points? (i.e a wall)

I'm doing this for an STW [Shoot Through Walls] detector plugin.

Last edited by cravenge; 02-24-2018 at 07:57.
cravenge is offline
Addicted.
AlliedModders Donor
Join Date: Dec 2013
Location: 0xA9D0DC
Old 02-24-2018 , 09:53   Re: Get the distance between two different z-axis points
Reply With Quote #6

Quote:
Originally Posted by cravenge View Post
Okay, now that has been taken care of... How to be sure that no entity is blocking the two z-axis points? (i.e a wall)

I'm doing this for an STW [Shoot Through Walls] detector plugin.
https://sm.alliedmods.net/new-api/sdktools_trace
Addicted. is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 02-24-2018 , 11:16   Re: Get the distance between two different z-axis points
Reply With Quote #7

Quote:
Originally Posted by Addicted. View Post
[...]
I'm still not familiar with TraceRay's but I know that's the solution. It's just the problem of what I input in that function to check if a wall is between the two points.
cravenge is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 02-27-2018 , 09:33   Re: Get the distance between two different z-axis points
Reply With Quote #8

Hmm... I think I'm doing something wrong with the trace ray. The plugin kicked me when I was just looking indirectly to my target, which is a bot behind a wall.
PHP Code:
bool IsVisionBlocked(float fPos[3], float fTargetPos[3])
{
    
bool bObstacleFound;
    
float fTrajectory[3], fAng[3];
    
    
MakeVectorFromPoints(fPosfTargetPosfTrajectory);
    
GetVectorAngles(fTrajectoryfAng);
    
    
Handle hTrace TR_TraceRayFilterEx(fPosfAngMASK_SHOTRayType_InfiniteFilterEntity);
    if (
TR_DidHit(hTrace))
    {
        
float fTracePos[3];
        
TR_GetEndPosition(fTracePoshTrace);
        
        if ((
GetVectorDistance(fPosfTracePosfalse) + 25.0) >= GetVectorDistance(fPosfTargetPos))
        {
            
bObstacleFound false/* client is getting a clear visual to a target. */
        
}
    }
    else
    {
        
bObstacleFound true/* Hmm, something has blocked the client's line of sight. */
    
}
    
    
delete hTrace;
    return 
bObstacleFound;
}

public 
bool FilterEntity(int entityint contentsMaskany data)
{
    return (
entity && IsValidEntity(entity));

I tried switching the result of the bool but the plugin kicked me when my back was facing the target, who is still behind a wall.

Last edited by cravenge; 02-27-2018 at 09:34.
cravenge is offline
Pelipoika
Veteran Member
Join Date: May 2012
Location: Inside
Old 02-27-2018 , 10:03   Re: Get the distance between two different z-axis points
Reply With Quote #9

I'm not sure if this is what you want but here you go https://github.com/Pelipoika/TF2_Nex...sp#L1365-L1392
__________________
Pelipoika is offline
Addicted.
AlliedModders Donor
Join Date: Dec 2013
Location: 0xA9D0DC
Old 02-27-2018 , 10:21   Re: Get the distance between two different z-axis points
Reply With Quote #10

You can also check out the ClientCanSeeTarget() function in this plugin https://github.com/Franc1sco/aimbot/...t.sp#L553-L577

Last edited by Addicted.; 02-27-2018 at 10:37.
Addicted. 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 21:51.


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