Rules FAQ Members List Search Register Login

 Raised This Month: \$18 Target: \$400 4%

Author Message
cravenge
Veteran Member
Join Date: Nov 2015
Location: Black Hole
 02-22-2018 , 00:58   Get the distance between two different z-axis points #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?
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
 02-22-2018 , 01:05   Re: Get the distance between two different z-axis points #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. __________________
cravenge
Veteran Member
Join Date: Nov 2015
Location: Black Hole
 02-22-2018 , 01:46   Re: Get the distance between two different z-axis points #3 I will try your suggestions. Thanks!
hmmmmm
Great Tester of Whatever
Join Date: Mar 2017
Location: ...
 02-22-2018 , 14:23   Re: Get the distance between two different z-axis points #4 PHP Code: ``` float zDist = FloatAbs( vec1[2] - vec2[2] );  ```
cravenge
Veteran Member
Join Date: Nov 2015
Location: Black Hole
 02-24-2018 , 07:51   Re: Get the distance between two different z-axis points #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.
AlliedModders Donor
Join Date: Dec 2013
Location: 0xA9D0DC
02-24-2018 , 09:53   Re: Get the distance between two different z-axis points
#6

Quote:
 Originally Posted by cravenge 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
cravenge
Veteran Member
Join Date: Nov 2015
Location: Black Hole
02-24-2018 , 11:16   Re: Get the distance between two different z-axis points
#7

Quote:
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
Veteran Member
Join Date: Nov 2015
Location: Black Hole
 02-27-2018 , 09:33   Re: Get the distance between two different z-axis points #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(fPos, fTargetPos, fTrajectory);    GetVectorAngles(fTrajectory, fAng);        Handle hTrace = TR_TraceRayFilterEx(fPos, fAng, MASK_SHOT, RayType_Infinite, FilterEntity);    if (TR_DidHit(hTrace))    {        float fTracePos[3];        TR_GetEndPosition(fTracePos, hTrace);                if ((GetVectorDistance(fPos, fTracePos, false) + 25.0) >= GetVectorDistance(fPos, fTargetPos))        {            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 entity, int contentsMask, any 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.
Pelipoika
Veteran Member
Join Date: May 2012
Location: Inside
 02-27-2018 , 10:03   Re: Get the distance between two different z-axis points #9 I'm not sure if this is what you want but here you go https://github.com/Pelipoika/TF2_Nex...sp#L1365-L1392 __________________
AlliedModders Donor
Join Date: Dec 2013
Location: 0xA9D0DC
 02-27-2018 , 10:21   Re: Get the distance between two different z-axis points #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.

 Thread Tools Display Modes Linear Mode

 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 Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Server Discussion     Source Servers (SRCDS)     HL1 Servers (HLDS) AMX Mod X     News     Bug Reports     General     Off-Topic     Plugins         Suggestions / Requests         Approved Plugins         New Plugin Submissions         Unapproved/Old Plugins         Translation Request         High-Traffic Plugins             GunGame             UAIO (Ultimate All-In-One Plugin)             xREDIRECT             CSDM             AMX Super             RuneMod             Zombie Plague Mod             SuperHero Mod                 News                 Tech Support                 Scripting Help                 Off-Topic / General Chat                 Heroes                     Suggestions / Requests                     Approved Heroes                     New Submissions                     Unapproved/Old Heroes                         Module Heroes                     SuperHero Mod Stats - By 123                 (OLD) Bug Reports     Scripting         Scripting Help         Code Snippets/Tutorials         Module Coding     Donor Access SourceMod     News     General     Plugins         Plugins         Unapproved Plugins         Plugin/Gameplay Ideas and Requests         High-Traffic Plugins             SourceMod Anti-Cheat             Zombie:Reloaded             SourceBans / SourceBans++             VSH / Freak Fortress             Store             SM_Hosties             HLstatsX:CE     Scripting     Extensions     Snippets and Tutorials     Donor Access     Metamod: Source         Metamod:Source Plugins         Metamod:Source Questions         Coding MM:S Plugins & SM Extensions Hosted Stuff     Asherkin's Plugins         TFDodgeball         TF2Items         SteamTools     Bail's Plugins         CSDM         CS:S DM Off-Topic & Trash     Off-Topic     Trash

All times are GMT -4. The time now is 13:48.

 DMCA - Archive - Top