Raised This Month: $19 Target: $400
 4% 

trace ray not hitting head


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
farawayf
Senior Member
Join Date: Jan 2019
Old 04-02-2021 , 13:25   trace ray not hitting head
Reply With Quote #1

as the title of topic says, traceray never hits players head.
is there any way to get if client aiming head ?
farawayf is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 04-02-2021 , 14:13   Re: trace ray not hitting head
Reply With Quote #2

show your code
Bacardi is offline
farawayf
Senior Member
Join Date: Jan 2019
Old 04-02-2021 , 15:04   Re: trace ray not hitting head
Reply With Quote #3

Quote:
Originally Posted by Bacardi View Post
show your code
it not matters. i tried any snippets from topics and all of them not hitting players head.
for example https://forums.alliedmods.net/showpo...4&postcount=12|
hits body, but not head.
and "int GetClientAimTarget(int client, bool only_clients)" have same problem.

the game is cs:s. all player models are default one.

Last edited by farawayf; 04-02-2021 at 15:09.
farawayf is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 04-02-2021 , 17:40   Re: trace ray not hitting head
Reply With Quote #4

Maybe you have to use TR_TraceHullFilterEx.

Btw is always important to share some code that you are using if you want some help. (I know you shared that link but the reply was kinda rude IMO)

No code is like a shot in the dark.
__________________
Marttt is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 04-02-2021 , 17:42   Re: trace ray not hitting head
Reply With Quote #5

yep. Show your code next time...
*I quick tested in cs:go tough...


PHP Code:
#include <sdktools>

// ---------------------------
//  Hit Group standards
// ---------------------------
#define        HITGROUP_GENERIC    0
#define        HITGROUP_HEAD        1
#define        HITGROUP_CHEST        2
#define        HITGROUP_STOMACH    3
#define        HITGROUP_LEFTARM    4    
#define        HITGROUP_RIGHTARM    5
#define        HITGROUP_LEFTLEG    6
#define        HITGROUP_RIGHTLEG    7
#define        HITGROUP_GEAR        10            // alerts NPC, but doesn't do damage or bleed (1/100th damage)



public void OnPluginStart()
{
    
RegConsoleCmd("sm_test"test);
}

public 
Action test(int clientint args)
{
    
float eyespos[3];
    
GetClientEyePosition(clienteyespos);
    
float eyesang[3];
    
GetClientEyeAngles(clienteyesang);

    
Handle Ray TR_TraceRayFilterEx(eyesposeyesangMASK_SHOTRayType_Infinitefilterclient);
    
int index TR_GetEntityIndex(Ray);
    
int hitgroup TR_GetHitGroup(Ray);

    if(
index && hitgroup == HITGROUP_HEAD)
        
PrintToServer("%N HitBoxIndex %i HitGroup %i"indexTR_GetHitBoxIndex(Ray), hitgroup);
    
    
delete Ray;
    


    return 
Plugin_Handled;
}



public 
bool filter(int entityint contentsMaskany data)
{
    
// Don't look yourself, only client indexes
    
if(entity != data && entity && entity <= MaxClients) return true;

    return 
false;


Last edited by Bacardi; 04-02-2021 at 19:31.
Bacardi is offline
farawayf
Senior Member
Join Date: Jan 2019
Old 04-02-2021 , 18:16   Re: trace ray not hitting head
Reply With Quote #6

i wasnt trying to be rude. thats just the answer.
i did not write my code because after it i tried a lot of codes and all the results were the same, so it was just nonse doing it again.
Thank you both.

Will test your example when ill be free. Bacardi
farawayf is offline
Reply


Thread Tools
Display Modes

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 22:32.


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