1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. FYI - Your missing Content - your only seeing non-registered Guest Information... Quickly register and sign on to see more! (Shoutbox, current activity etc, more forums)
    Dismiss Notice
  3. Hi There Guest! If your not sure about buying from us at HackersAdvantage, or unsure of our Detection Rates - Please Register and make a post asking! Our Staff and Members will reply to every question! We have the longest non-detection streaks in the industry! We offer a 3 day refund on hacks that you can not get to work on your PC. NO OTHER SITE DOES THIS!
    Dismiss Notice

Discuss Visual Studio 2013 And Directx Math

Discussion in 'Hack Coding Section' started by KozmoK, Dec 1, 2014.

  1. KozmoK
    Online

    KozmoK Hacker Cracker Staff Member Admin

    Greetings all! I started converting all my old DirectX Math that I have used from DX9 days to the new Windows 8 D3DX11 equivalent DirectXMath. D3DXMath is now deprecated in windows 8. Although you can still compile and mix and match both, I wanted a more cleaner source so out with the old in with the new!

    So with DirectXMath its basically the same. I use the DirectTK SimpleMath helper functions which really make porting it very easy.

    The Example below uses the FrostBite Classes for Vec3 and I show how to get the Distance from the Local Player (You) and any object Vector (world coordinates) whether your in a vehicle or on foot.

    Now I could have expanded the FrostBite (fb) Vector classes and not used any SimpleMath wrappers and added a length/distance function, but hey I wanted to make a post showing the new code.

    Code:
    float getDistanceFromLocalPlayer(SimpleMath::Vector3 vOrigin)
    {
        if (!g_gameContext || !g_gameContext->m_clientPlayerManager)
            return 0.0f;
    
        fb::ClientPlayer *pLocal = g_gameContext->m_clientPlayerManager->m_localPlayer;
        if (!IsValid_Ptr(pLocal))
            return 0.0f;
    
        fb::Vec3 vLocal = fb::Vec3(0, 0, 0);
    
        if (pLocal->isInVehicle())
        {
            fb::ClientVehicleEntity *pLocalCVE = getVehicleEntity(pLocal);
            if (!IsValid_Ptr(pLocalCVE))
                return 0.0f;
            vLocal = pLocalCVE->getOrigin();
        } else {
            fb::ClientSoldierEntity *pLocalCSE = getClientSoldierEntity(pLocal);
            if (!IsValid_Ptr(pLocalCSE))
                return 0.0f;
            vLocal = pLocalCSE->getOrigin();
        }
    
        SimpleMath::Vector3 vLocalOriginDiff = SimpleMath::Vector3(vLocal.x, vLocal.y, vLocal.z) - vOrigin;
        float fDistance = XMVectorGetX(XMVector3Length(vLocalOriginDiff));
        return fDistance;
    }
    Like I said to better optimize the code above, I'd remove the last 3 lines and replaced with this one line had I used FB's classes:

    Code:
    return vLocal.distanceFrom(vOrigin);
    
     
    Last edited: Dec 1, 2014
    chadmeister likes this.
  2. AxonXi
    Offline

    AxonXi Maximum_$$

    hi Ko,i have a problem about codol cheat that if it's necessary to install DirectX 11?
     
  3. TheGrinch123
    Offline

    TheGrinch123 BAD ASS MOFO VIP Ultimate Hax

    Koz, If you update your code to D3DXMath will those of us that have elected to remain with Windows 7 have a problem? Or should we think about upgrading to Windows 10 when supported?
     
  4. KozmoK
    Online

    KozmoK Hacker Cracker Staff Member Admin

    No, its all the math inside the hack itself - it has nothing to do with your version of windows.
     
  5. TheGrinch123
    Offline

    TheGrinch123 BAD ASS MOFO VIP Ultimate Hax

    Thanks
     

Share This Page