SolvedWorld2Screen Floating Around

Posts 1–9 of 9 · Page 1 of 1
World2Screen Floating Around
So I started with ESP some time ago and everything's pretty fine now, the only problem I have is that the names of some player(s) just float around in the middle of the screen. Anybody knows what Im doing wrong? (Im careful with codes since I dont like copypasta, if it's really needed, just gimme a call)
um maybe you are not using W2S correctly?
post some codes pls
Code:
if(WorldToScreen(pEntity->Origin, fScreen[0], fScreen[1]))
Code:
bool WorldToScreen(Vec3 vWorldLocation, float *fScreenX, float *fScreenY)
	{
		int CenterX = CRefDef->Width / 2;
		int CenterY = CRefDef->Height / 2;

		Vec3 vLocal = vWorldLocation;
		vLocal.operator- (CRefDef->ViewOrg);

		vLocal.operator* (CRefDef->ViewAxis);
		if(vLocal.Z < 0.001f)
			return FALSE;

		*fScreenX = floor(CenterX * (1.f - (vLocal.X / CRefDef->FovX / vLocal.Z )));
		*fScreenY = floor(CenterY * (1.f - (vLocal.Y / CRefDef->FovY / vLocal.Z )));	

		return TRUE;
	}
This is how I got it now, it's for mw3. Just gives me a few names on the center of my screen...
mm didnt expect u use something like that well i use this:
Code:
bool WorldToScreen(LPDIRECT3DDEVICE9 pDev, D3DXVECTOR3 vWorld, D3DXVECTOR3* Pos)
{
	D3DVIEWPORT9 viewPort = {0};
	D3DXMATRIX projection, view, world;
  	pDev->GetTransform(D3DTS_VIEW, &view);
	pDev->GetTransform(D3DTS_PROJECTION, &projection);
	pDev->GetTransform(D3DTS_WORLD, &world);
	pDev->GetViewport(&viewPort);
	D3DXVec3Project(Pos, &vWorld, &viewPort, &projection, &view, &world);
	if(Pos->z < 1)
	{
		return true;
	}
	return false;
}
works fine with me
Quote Originally Posted by giniyat101 View Post
mm didnt expect u use something like that well i use this:
Code:
bool WorldToScreen(LPDIRECT3DDEVICE9 pDev, D3DXVECTOR3 vWorld, D3DXVECTOR3* Pos)
{
	D3DVIEWPORT9 viewPort = {0};
	D3DXMATRIX projection, view, world;
  	pDev->GetTransform(D3DTS_VIEW, &view);
	pDev->GetTransform(D3DTS_PROJECTION, &projection);
	pDev->GetTransform(D3DTS_WORLD, &world);
	pDev->GetViewport(&viewPort);
	D3DXVec3Project(Pos, &vWorld, &viewPort, &projection, &view, &world);
	if(Pos->z < 1)
	{
		return true;
	}
	return false;
}
works fine with me
Maybe any ways to get mine working? Since I dont wanna screw up my complete project converting everything to D3D and in the end noticing it doesn't work..
Quote Originally Posted by Eidolon View Post


Maybe any ways to get mine working? Since I dont wanna screw up my complete project converting everything to D3D and in the end noticing it doesn't work..
not sure.. but if you are not using d3d to make esp, what are you using :S
Quote Originally Posted by giniyat101 View Post
not sure.. but if you are not using d3d to make esp, what are you using :S
The engine (cardoow style). Only the texts Im writing with D3D.
I got this struct 'Vec3' with X, Y, Z and some functions.
//Solved myself
Marked Solved. No more posting.
Posts 1–9 of 9 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us