Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › MultiPlayer Game Hacks & Cheats › Battlefield Hacks & Cheats › Battlefield 3 (BF3) Hacks & Cheats › Battlefield 3 Help › ViewMatrix problem

ViewMatrix problem

Posts 1–3 of 3 · Page 1 of 1
MR
MrKerras
ViewMatrix problem
I found some functions for processing 3D position to a point on a 2D screen.
But it is not working properly, here's the function:
Code:
bool WorldToScreen2(float * from, float * to, float fovY, TWorldToScreenMatrix firstPersonTransform, int ScreenWidth, int ScreenHeight)
{
    int height = ScreenHeight;
    int width = ScreenWidth;
    float aspect = (float)width /  (float)height;

    D3DXVECTOR3 vOrigin = D3DXVECTOR3(firstPersonTransform.flMatrix[3][0],firstPersonTransform.flMatrix[3][1],firstPersonTransform.flMatrix[3][2]);
    D3DXVECTOR3 vLeft    = D3DXVECTOR3(firstPersonTransform.flMatrix[0][0],firstPersonTransform.flMatrix[0][1],firstPersonTransform.flMatrix[0][2]);
    D3DXVECTOR3 vUp        = D3DXVECTOR3(firstPersonTransform.flMatrix[1][0],firstPersonTransform.flMatrix[1][1],firstPersonTransform.flMatrix[1][2]);
    D3DXVECTOR3 vForward = D3DXVECTOR3(firstPersonTransform.flMatrix[2][0],firstPersonTransform.flMatrix[2][1],firstPersonTransform.flMatrix[2][2]);

    D3DXMATRIX viewMatrix;
        D3DXMatrixIdentity(&viewMatrix);    
    viewMatrix._11 = vLeft.x; viewMatrix._12 = vUp.x; viewMatrix._13 = vForward.x;
        viewMatrix._21 = vLeft.y; viewMatrix._22 = vUp.y; viewMatrix._23 = vForward.y;
        viewMatrix._31 = vLeft.z; viewMatrix._32 = vUp.z; viewMatrix._33 = vForward.z;

        viewMatrix._41 = -D3DXVec3Dot(&vOrigin, &vLeft);
        viewMatrix._42 = -D3DXVec3Dot(&vOrigin, &vUp);
        viewMatrix._43 = -D3DXVec3Dot(&vOrigin, &vForward);

    D3DXMATRIXA16 Proj;
    D3DXMatrixPerspectiveFovRH( &Proj, fovY,  aspect , 0.1f,  10000.0f);
    D3DXMATRIXA16 viewProjecti******** = viewMatrix * Proj;

    float mX = width * 0.5f ;
    float mY = height * 0.5f ;

    float w =
            viewProjecti********(0,3) * from[0] +
            viewProjecti********(1,3) * from[1] +
            viewProjecti********(2,3) * from[2] +
            viewProjecti********(3,3);

        if( w < 0.0001f )
        {
            return false;
        }

        float x =
            viewProjecti********(0,0) * from[0] +
            viewProjecti********(1,0) * from[1] +
            viewProjecti********(2,0) * from[2] +
            viewProjecti********(3,0);

        float y =
            viewProjecti********(0,1) * from[0] +
            viewProjecti********(1,1) * from[1] +
            viewProjecti********(2,1) * from[2] +
            viewProjecti********(3,1);

        to[0] = mX + mX * x / w;
        to[1] = mY - mY * y / w;
        
        return true;
}
My structure TWorldToScreenMatrix:
Code:
typedef struct
{
    float flMatrix [4][4];
}TWorldToScreenMatrix;
Original code:
Code:
bool cReader::worldToScreen(fb::Vec3 vWorldLocationVec3,fb::Vec3* vOut)
{
    int height = getScreenHeight();
    int width = getScreenWidth();
    float aspect = (float)width /  (float)height;

    fb::Mat4 firstPersonTransform;FLOAT fovY;    
    DWORD OffsetGameRenderer = 0x02384D78;
    DWORD GameRenderer;
    ReadProcessMemory(pHandle, (void*)(OffsetGameRenderer), &GameRenderer, 4, NULL);
    ReadProcessMemory(pHandle, (void*)(GameRenderer + 0x98), &fovY, sizeof(FLOAT), NULL);    
    ReadProcessMemory(pHandle, (void*)(GameRenderer + 0x50), &firstPersonTransform, sizeof(fb::Mat4), NULL);    
    
    D3DXVECTOR3 vOrigin = D3DXVECTOR3(firstPersonTransform[3][0],firstPersonTransform[3][1],firstPersonTransform[3][2]);
    D3DXVECTOR3 vLeft    = D3DXVECTOR3(firstPersonTransform[0][0],firstPersonTransform[0][1],firstPersonTransform[0][2]);
    D3DXVECTOR3 vUp        = D3DXVECTOR3(firstPersonTransform[1][0],firstPersonTransform[1][1],firstPersonTransform[1][2]);
    D3DXVECTOR3 vForward = D3DXVECTOR3(firstPersonTransform[2][0],firstPersonTransform[2][1],firstPersonTransform[2][2]);

    D3DXMATRIX viewMatrix;
        D3DXMatrixIdentity(&viewMatrix);    
    viewMatrix._11 = vLeft.x; viewMatrix._12 = vUp.x; viewMatrix._13 = vForward.x;
        viewMatrix._21 = vLeft.y; viewMatrix._22 = vUp.y; viewMatrix._23 = vForward.y;
        viewMatrix._31 = vLeft.z; viewMatrix._32 = vUp.z; viewMatrix._33 = vForward.z;

         viewMatrix._41 = -D3DXVec3Dot(&vOrigin, &vLeft);
         viewMatrix._42 = -D3DXVec3Dot(&vOrigin, &vUp);
         viewMatrix._43 = -D3DXVec3Dot(&vOrigin, &vForward);

    D3DXMATRIXA16 Proj;
    D3DXMatrixPerspectiveFovRH( &Proj, fovY,  aspect , 0.1f,  10000.0f);
    D3DXMATRIXA16 viewProjecti******** = viewMatrix * Proj;

    float mX = width * 0.5f ;
    float mY = height * 0.5f ;

    float w =
            viewProjecti********(0,3) * vWorldLocationVec3.x +
            viewProjecti********(1,3) * vWorldLocationVec3.y +
            viewProjecti********(2,3) * vWorldLocationVec3.z +
            viewProjecti********(3,3);

        if( w < 0.0001f )
        {
            vOut->z = w;

            return false;
        }

        float x =
            viewProjecti********(0,0) * vWorldLocationVec3.x +
            viewProjecti********(1,0) * vWorldLocationVec3.y +
            viewProjecti********(2,0) * vWorldLocationVec3.z +
            viewProjecti********(3,0);

        float y =
            viewProjecti********(0,1) * vWorldLocationVec3.x +
            viewProjecti********(1,1) * vWorldLocationVec3.y +
            viewProjecti********(2,1) * vWorldLocationVec3.z +
            viewProjecti********(3,1);

        vOut->x = mX + mX * x / w;
        vOut->y = mY - mY * y / w;
        vOut->z = w;
        
        return true;
}
Of course, functions ReadProcessMemory and Offset gave earlier in another function, but the data from it are used in my function WorldToScreen2.


Can anyone help me improve functionality or write a new that will work properly?

I would like to write the External Hack.
#1 · edited 11y ago · 11y ago
smallC
smallC
what is wrong? instead of using TWorldToScreenMatrix , use D3DXMATRIX

and firstPersonTransform(3)(0) instead of firstPersonTransform[3][0].

But be sure to have correct witdth and height. I don't know how you get them.
#2 · 11y ago
MR
MrKerras
Could not find match for 'D3DXMATRIX:perator()(int)'

I have used this firstPersonTransform(3,0)

Still not working, all the boxes are aligned diagonally and only a little change position but still at an angle.
#3 · edited 11y ago · 11y ago
Posts 1–3 of 3 · Page 1 of 1

Post a Reply

Similar Threads

  • WPE problem...By styx23 in General Game Hacking
    8Last post 20y ago
  • Problem Wit Hacking ProgramsBy f5awp in General Gaming
    5Last post 20y ago
  • hacking problemsBy iwillkillyou in WarRock - International Hacks
    11Last post 20y ago
  • To All GunZ Down 02-07-06 PROBLEMBy WertyRO in Gunz General
    18Last post 20y ago
  • ProblemBy lambda in Gunz General
    3Last post 20y ago

Tags for this Thread

#bf3#hack#viewmatrix