AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   trace_line() issue (https://forums.alliedmods.net/showthread.php?t=277154)

NikKOo31 01-03-2016 15:37

trace_line() issue
 
Hey guys. I'm trying to detect if there's some entity or wall between my entity (ent) and a player (id), and I'm having issues with trace_line native

PHP Code:

    new Float:vstart[3], Float:vend[3], Float:vret[3]
    
entity_get_vector(entEV_VEC_originvstart)
    
entity_get_vector(idEV_VEC_originvend)

    new 
hit trace_line(entvstartvendvret)
    new 
hitr traceresult(TR_Hit)
    new 
Float:fraction
    traceresult
(TR_Fractionfraction)

    
client_print(idprint_chat"trace_line ->  hit = %d  hitr = %d  fraction = %.1f"hithitrfraction

It always returns the same values, no matter if there is or isn't anything between ent and id
Code:

trace_line ->  hit = 0  hitr = -1  fraction = 0.0
I've tried the inverse trace, from the player (id) to the entity (ent) but keep getting the same results. What am I doing wrong?


All times are GMT -4. The time now is 09:28.

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