AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   calc vecStart and vecStop of a traceline with TR_flFraction and TR_vecEndPos (https://forums.alliedmods.net/showthread.php?t=92140)

SchlumPF* 05-10-2009 16:43

calc vecStart and vecStop of a traceline with TR_flFraction and TR_vecEndPos
 
hi i got a problem, at least i got a result which must be wrong :D
i got Ham_TraceAttack (pre) and want to calculate the start and stop pos of the traceline/tracehull the engine did (not TR_vecEndPos) so i guess i have to do the following:
start = stop - v_forward * x where x is depending on the attack (either 32.0 or 48.0), stop = vecEndPos * (2-fraction)
i just got a few min to test that but what i got seemed to be wrong and thats why i want to ask you whether i missed sth like EngFunc_MakeVectors or whatever cuz im not sure. i may post additional information tomorrow cuz i gotta sleep now :X
thx in advice

//edit
no time to test this but stop should be:
stop = vecEndPos * (1/fraction)

//edit2
forgot to mention that hösdk told me that the param Float:direction[3] of Ham_TraceAttack is v_forward which is used to calculate the stop vector (stop = start + forward * x)

ConnorMcLeod 05-10-2009 19:14

Re: calc vecStart and vecStop of a traceline with TR_flFraction and TR_vecEndPos
 
I don't know how to retrieve, but try to compare the tr results with this :

PHP Code:

#define m_HackedGunPos_x 90
#define m_HackedGunPos_y 91
#define m_HackedGunPos_z 92

    
new Float:vecSrc[3], Float:vecDir[3]
    
pev(idpev_v_anglevecSrc)
    
pev(idpev_punchanglevecDir)
    
xs_vec_add(vecSrcvecDirvecSrc)
    
engfunc(EngFunc_MakeVectorsvecSrc)

    
vecSrc[0] = get_pdata_float(idm_HackedGunPos_x)
    
vecSrc[1] = get_pdata_float(idm_HackedGunPos_y)
    
vecSrc[2] = get_pdata_float(idm_HackedGunPos_z)

    
global_get(glb_v_upvecDir)
    
xs_vec_mul_scalar(vecDir2.0vecDir)
    
xs_vec_sub(vecSrcvecDirvecSrc)

    
global_get(glb_v_forwardvecDir)    

    
xs_vec_add(vecDirvecSrcvecDir)
    
xs_vec_mul_scalar(vecDir8192.0vecDir)

    
engfunc(EngFunc_TraceLinevecSrcvecDirDONT_IGNORE_MONSTERSid0



All times are GMT -4. The time now is 01:25.

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