Results 1 to 3 of 3
  1. #1
    samlarenskoog's Avatar
    Join Date
    Apr 2016
    Gender
    male
    Posts
    104
    Reputation
    25
    Thanks
    57
    My Mood
    Cheerful

    Distance Based FOV

    Last night I made a distance based FOV with SEGnosis guide. I does not work and returns realDist returns weird values (very high values which seems to depend on which angle I am looking towards an enemy).
    Code:
    int GetClosestEnemy(HANDLE hProc, DWORD clientDll, DWORD engineDll, Vector localPosition, Vector viewAngles)
    {
    	float shortestDist = 5.f;
    	Vector closestAng;
    	int closestEnemy = -1;
    	viewAngles.x += Player.getPunch(hProc, clientDll).x * 2;
    	viewAngles.y += Player.getPunch(hProc, clientDll).y * 2;
    	
    	for (int i = 0; i < 64; i++)
    	{
    		DWORD ent = Entity.getEntityBase(hProc, clientDll, i);
    		if (!ent)
    			continue;
    
    		if (Entity.getHealth(hProc, clientDll, i) > 0 && Entity.getTeam(hProc, clientDll, i) != Player.getTeam(hProc, clientDll) && i > 0 && Entity.radarSpotted(hProc, clientDll, i) == true && Entity.getFlags(hProc, clientDll, i) != 776)
    		{
    			
    			Vector headPos = Entity.getHeadPos(hProc, clientDll, i);
    			Vector vAngle = CalcAngle(localPosition, headPos);
    			Normalize(vAngle);
    
    			float dist3d = Get3dDist(localPosition, headPos);
    			float dist = sqrt(pow(viewAngles.x - vAngle.x, 2) + pow(viewAngles.y - vAngle.y, 2));
    			
    			float yaw = sin((abs(viewAngles.y - vAngle.y)) * 57.295779513082f) * dist3d;
    			float pitch = sin((abs(viewAngles.x - vAngle.x)) * 57.295779513082f) * dist3d;
    			float realDist = sqrt(powf(pitch, 2.0) + powf(yaw, 2.0));
    			std::cout << realDist << std::endl;
    
    			
    			if (realDist < shortestDist)
    			{
    				shortestDist = realDist;
    				closestEnemy = i;
    			}
    		}
    		if (shortestDist != 5.f && closestEnemy > 0 && closestEnemy < 64)
    		{
    			return closestEnemy;
    		}
    	}
    }
    Code:
    float Get3dDist(Vector localPosition, Vector enemyPos)
    {
    	float dist;
    	dist = sqrt(pow(localPosition.x - enemyPos.x, 2) + pow(localPosition.y - enemyPos.y, 2) + pow(localPosition.z - enemyPos.z, 2));
    	return dist;
    }
    Last edited by samlarenskoog; 07-31-2016 at 12:30 PM.

  2. #2
    SP1K3CSGO's Avatar
    Join Date
    Mar 2016
    Gender
    male
    Posts
    284
    Reputation
    10
    Thanks
    922
    My Mood
    Sad
    Code:
    float GetFovFraction(int target, float distance)
    {
    	Vector Angles;
    	CalcAngle(EntityList[target].BonePosition, Angles);
    	Vector delta = Angles - pPlayer->ViewAngles();
    	NormalizeAngle(delta);
    	float fov = sqrt(powf(delta.x, 2) + powf(delta.y, 2));
    	return distance * sin(DegToRad(fov)) * 0.5f;
    }
    so I get Distance Based Fov

  3. #3
    Smoke's Avatar
    Join Date
    Nov 2014
    Gender
    male
    Posts
    11,899
    Reputation
    2661
    Thanks
    4,610
    My Mood
    Amazed
    Been over a week since last update/bump, marked as "Unresolved".

    /Closed.


    CLICK TO BUY NOW!!


    Quote Originally Posted by Liz View Post
    This is my first vouch, ever. Rapidgator account worked perfectly. Would buy in the future.

Similar Threads

  1. [Help] fov distance based.
    By s0m8t in forum Counter-Strike 2 Coding & Resources
    Replies: 2
    Last Post: 07-19-2016, 10:47 AM
  2. [Help] FOV Based Aimbot (C++)
    By Smite2120 in forum Counter-Strike 2 Coding & Resources
    Replies: 5
    Last Post: 04-22-2016, 11:38 AM
  3. Java based multiplayer games
    By Tops in forum Hack Requests
    Replies: 8
    Last Post: 03-13-2008, 11:28 PM
  4. Spawn on enemy base
    By analog70 in forum WarRock - International Hacks
    Replies: 36
    Last Post: 03-18-2007, 04:17 AM
  5. Web-based game hacking..
    By Krilliam in forum General Game Hacking
    Replies: 7
    Last Post: 02-20-2006, 01:12 PM