CG_Trace

Posts 1–4 of 4 · Page 1 of 1
CG_Trace
So i'm having a small problem with CG_Trace when i'm ingame it just aims through everything here is what i'm currently using:

void (*CG_Trace)(cTrace_t *trace,vec3_t start,vec3_t mins,vec3_t maxs,vec3_t end,int skipNumber,int Mask) = (void(__cdecl *)(cTrace_t*, vec3_t,vec3_t,vec3_t,vec3_t,int, int))0x660980;

which can be found here:
Code:
00460BE0   8B4424 20        MOV EAX,DWORD PTR SS:[ESP+20]
00460BE4   8B4C24 1C        MOV ECX,DWORD PTR SS:[ESP+1C]
00460BE8   8B5424 08        MOV EDX,DWORD PTR SS:[ESP+8]
00460BEC   81EC 84000000    SUB ESP,84
00460BF2   53               PUSH EBX
00460BF3   8B9C24 94000000  MOV EBX,DWORD PTR SS:[ESP+94]
00460BFA   55               PUSH EBP
00460BFB   8BAC24 A0000000  MOV EBP,DWORD PTR SS:[ESP+A0]
00460C02   56               PUSH ESI
00460C03   8BB424 A0000000  MOV ESI,DWORD PTR SS:[ESP+A0]
00460C0A   57               PUSH EDI
00460C0B   8BBC24 98000000  MOV EDI,DWORD PTR SS:[ESP+98]
00460C12   50               PUSH EAX
00460C13   51               PUSH ECX
00460C14   56               PUSH ESI
00460C15   53               PUSH EBX
00460C16   55               PUSH EBP
00460C17   52               PUSH EDX
00460C18   57               PUSH EDI
00460C19   E8 62FD1F00      CALL BlackOps.00660980
00460C1E   F3:0F104F 10     MOVSS XMM1,DWORD PTR DS:[EDI+10]
00460C23   83C4 1C          ADD ESP,1C
this is how i'm using it:

Code:
bool IsVisible( vec3_t vecpoint )
{
	cTrace_t trace;
	
	CG_Trace( &trace,refdef->vOrigin,vecpoint,cg->clientNum,0x803003);

	return( trace.fraction == 1.0f );
}
and i think the trace struct that kingorgy posted is correct.

would someone kindly try this function and see if they get the same results?

many thanks.

credits:cardoow,raiders,kingorgy.
change your mask
first off thanks for the reply and secondly ive found the correct mask for this trace func which seems to do the same thing aiming through walls and so on...
try
Code:
void (*CG_Trace)(Trace* Trace, vec3_t Start, vec3_t End, int skipNumber, int mask, int a6, int a7) = (void (__cdecl *)(Trace* , vec3_t , vec3_t , int , int , int , int ))0x004DA230;//done

struct Trace
{
	vec3_t            HitPos;
	int               UNKNOW1; 
	float	          fraction;
	float             ViewX;
	float             ViewY;
        bool              Solid;
	int               entityNum;
	float             UNKNOW2;
	char              z_crap2[32];
	vec3_t            HitPos2;
};
Trace* CTrace;

bool CMisc::isVisible ( vec3_t End )
{
	if( !CTrace ) 
	{ 
		CTrace = new Trace; ZeroMemory( CTrace, sizeof( Trace ) ); 
	}
	CG_Trace	( CTrace, Refdef->Viewport, End, 0, 0x803003, 0, 0 );
        
        return	CTrace->fraction == 1.0f;
}
Posts 1–4 of 4 · Page 1 of 1
This thread is closed for replies.

Tags for this Thread

None

Talk with us