Moving the mouse to WoW coordinates menu

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    shomoiog's Avatar Member
    Reputation
    20
    Join Date
    Dec 2008
    Posts
    11
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Moving the mouse to WoW coordinates

    For the coppypasta happy people, Kynox's 3d to 2d projection made easy. For the real implementation, keep just the comments, for the easy copy/paste one, keep it as it is. 3.0.8 compatible ofc. No need to blindly hoover around the screen searching for stuff anymore. Works out of process for easy testing, returns false when the mouse can be moved there (behind the camera, etc).

    Code:
    /////////////////////
    
    #define WOW_CAMERA_PTR1		0x10A5DAC
    #define WOW_CAMERA_OFFSET	0x000782C
    #define M_DEG2RAD		0.01745329251f
    
    struct SCameraInfo
    {
    	DWORD	dwFoo1[2];
    	//CVec3 vPos;
    	float	fPos[3];
    	//CMat3 matView;
    	float	fViewMat[3][3];
    	DWORD	dwFoo2[2];
    	float	fFov;
    };
    
    BOOL MoveMouseToWoWCoords( float x, float y, float z /* CVec3 vWoWPos*/, HWND hwndWoW, HANDLE hWoWProc )
    {
    	SCameraInfo camera;
    	LPBYTE	pAddr1;
    	LPBYTE	pAddr2;
    	DWORD	dwFoo;
    
    	if( !ReadProcessMemory( hWoWProc, (LPDWORD)WOW_CAMERA_PTR1, &pAddr1, 4, &dwFoo ) || dwFoo != 4 )
    		return FALSE;
    	if( !ReadProcessMemory( hWoWProc, pAddr1+WOW_CAMERA_OFFSET, &pAddr2, 4, &dwFoo ) || dwFoo != 4 )
    		return FALSE;
    	if( !ReadProcessMemory( hWoWProc, pAddr2, &camera, sizeof(SCameraInfo), &dwFoo ) || dwFoo != sizeof(SCameraInfo) )
    		return FALSE;
    
    	RECT rc;
    	if( !::GetClientRect( hwndWoW,&rc ) )
    		return FALSE;
    
    	//CVec3 vDiff = vWoWPos - camera.vPos;
    	float fDiff[3];
    	fDiff[0] = x-camera.fPos[0];
    	fDiff[1] = y-camera.fPos[1];
    	fDiff[2] = z-camera.fPos[2];
    
    	//float fProd = vDiff*camera.matView[0];
    	float fProd = 
    		fDiff[0]*camera.fViewMat[0][0] +
    		fDiff[1]*camera.fViewMat[0][1] +
    		fDiff[2]*camera.fViewMat[0][2];
    	if( fProd < 0 )
    		return FALSE;
    
    	//CVec3 vView = vDiff*!camera.matView;
    	float fInv[3][3];
    	fInv[0][0] = camera.fViewMat[1][1]*camera.fViewMat[2][2]-camera.fViewMat[1][2]*camera.fViewMat[2][1];
    	fInv[1][0] = camera.fViewMat[1][2]*camera.fViewMat[2][0]-camera.fViewMat[1][0]*camera.fViewMat[2][2];
    	fInv[2][0] = camera.fViewMat[1][0]*camera.fViewMat[2][1]-camera.fViewMat[1][1]*camera.fViewMat[2][0];
    	float fDet = camera.fViewMat[0][0]*fInv[0][0]+camera.fViewMat[0][1]*fInv[1][0]+camera.fViewMat[0][2]*fInv[2][0];
    	float fInvDet = 1.0f / fDet;
    	fInv[0][1] = camera.fViewMat[0][2]*camera.fViewMat[2][1]-camera.fViewMat[0][1]*camera.fViewMat[2][2];
    	fInv[0][2] = camera.fViewMat[0][1]*camera.fViewMat[1][2]-camera.fViewMat[0][2]*camera.fViewMat[1][1];
    	fInv[1][1] = camera.fViewMat[0][0]*camera.fViewMat[2][2]-camera.fViewMat[0][2]*camera.fViewMat[2][0];
    	fInv[1][2] = camera.fViewMat[0][2]*camera.fViewMat[1][0]-camera.fViewMat[0][0]*camera.fViewMat[1][2];
    	fInv[2][1] = camera.fViewMat[0][1]*camera.fViewMat[2][0]-camera.fViewMat[0][0]*camera.fViewMat[2][1];
    	fInv[2][2] = camera.fViewMat[0][0]*camera.fViewMat[1][1]-camera.fViewMat[0][1]*camera.fViewMat[1][0];
    	camera.fViewMat[0][0] = fInv[0][0]*fInvDet;
    	camera.fViewMat[0][1] = fInv[0][1]*fInvDet;
    	camera.fViewMat[0][2] = fInv[0][2]*fInvDet;
    	camera.fViewMat[1][0] = fInv[1][0]*fInvDet;
    	camera.fViewMat[1][1] = fInv[1][1]*fInvDet;
    	camera.fViewMat[1][2] = fInv[1][2]*fInvDet;
    	camera.fViewMat[2][0] = fInv[2][0]*fInvDet;
    	camera.fViewMat[2][1] = fInv[2][1]*fInvDet;
    	camera.fViewMat[2][2] = fInv[2][2]*fInvDet;
    	float fView[3];
    	fView[0] = fInv[0][0]*fDiff[0]+fInv[1][0]*fDiff[1]+fInv[2][0]*fDiff[2];
    	fView[1] = fInv[0][1]*fDiff[0]+fInv[1][1]*fDiff[1]+fInv[2][1]*fDiff[2];
    	fView[2] = fInv[0][2]*fDiff[0]+fInv[1][2]*fDiff[1]+fInv[2][2]*fDiff[2];
    
    	//CVec3 vCam( -vView.fY,-vView.fZ,vView.fX );
    	float fCam[3];
    	fCam[0] = -fView[1];
    	fCam[1] = -fView[2];
    	fCam[2] =  fView[0];
    
    	float    fScreenX = (rc.right-rc.left)/2.0f;
    	float    fScreenY = (rc.bottom-rc.top)/2.0f;
    	// Thanks pat0! Aspect ratio fix
    	float    fTmpX    = fScreenX/tan(((camera.fFov*44.0f)/2.0f)*M_DEG2RAD);
    	float    fTmpY    = fScreenY/tan(((camera.fFov*35.0f)/2.0f)*M_DEG2RAD);
    
    	POINT pctMouse;
    	//pctMouse.x = fScreenX + vCam.fX*fTmpX/vCam.fZ;
    	pctMouse.x = fScreenX + fCam[0]*fTmpX/fCam[2];
    	//pctMouse.y = fScreenY + vCam.fY*fTmpY/vCam.fZ;
    	pctMouse.y = fScreenY + fCam[1]*fTmpY/fCam[2];
    
    	if( pctMouse.x < 0 || pctMouse.y < 0 || pctMouse.x > rc.right || pctMouse.y > rc.bottom )
    		return FALSE;
    
    	if( !::ClientToScreen(hwndWoW,&pctMouse) )
    		return FALSE;
    	if( !::SetCursorPos(pctMouse.x,pctMouse.y) )
    		return FALSE;
    
    	return TRUE;
    }
    
    ///////////////////////////////////////
    
    
    0x004B4B20 -> GetCamera()

    Moving the mouse to WoW coordinates
  2. #2
    SKU's Avatar Contributor
    Reputation
    306
    Join Date
    May 2007
    Posts
    565
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yay linear algebra. +2rep

  3. #3
    Cursed's Avatar Contributor
    Reputation
    270
    Join Date
    Jun 2007
    Posts
    1,380
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Gj, contributing + giving credits = 3x +Rep
    Last edited by Cursed; 01-31-2009 at 04:03 AM.

  4. #4
    jbrauman's Avatar Member
    Reputation
    65
    Join Date
    Dec 2007
    Posts
    72
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Awesome, shouldn't be too hard to convert into any language.
    Edit: Actually having a bit of trouble converting to C# seems I've never worked in C++ before, if anyone has done that already can they whizz me a PM? Thanks.
    Last edited by jbrauman; 02-01-2009 at 07:21 PM.

  5. #5
    RiseAndShine's Avatar Member
    Reputation
    18
    Join Date
    Jan 2009
    Posts
    27
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Big thx! It would probably take me days of hard thinking to figure this out (if at all ^^).

    C#

    NoMorePasting.com

    Did make a few changes, added +25 Pixels to Y, cause somehow Y-Position is always off a little for me. Also, X-Position is always where Y should be in Memory and vice versa, so I swapped them.

  6. #6
    jbrauman's Avatar Member
    Reputation
    65
    Join Date
    Dec 2007
    Posts
    72
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by RiseAndShine View Post
    Big thx! It would probably take me days of hard thinking to figure this out (if at all ^^).

    C#

    NoMorePasting.com

    Did make a few changes, added +25 Pixels to Y, cause somehow Y-Position is always off a little for me. Also, X-Position is always where Y should be in Memory and vice versa, so I swapped them.
    Awesome. However I'm doing it the hackish way now and just injecting and doing Interact to it.

  7. #7
    g3gg0's Avatar Active Member
    Reputation
    32
    Join Date
    Mar 2008
    Posts
    86
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by RiseAndShine View Post
    Did make a few changes, added +25 Pixels to Y, cause somehow Y-Position is always off a little for me. Also, X-Position is always where Y should be in Memory and vice versa, so I swapped them.
    25 pixels off?
    you are running WoW in windowed mode?

    but something different:
    do you also see that the positions are little off when the object is in the corner of the window?
    i have this with any implementation

  8. #8
    naa's Avatar Contributor
    Reputation
    100
    Join Date
    Oct 2006
    Posts
    63
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by RiseAndShine View Post
    Big thx! It would probably take me days of hard thinking to figure this out (if at all ^^).

    C#

    NoMorePasting.com

    Did make a few changes, added +25 Pixels to Y, cause somehow Y-Position is always off a little for me. Also, X-Position is always where Y should be in Memory and vice versa, so I swapped them.
    Thank you.
    +Rep
    Last edited by naa; 02-09-2009 at 05:34 AM.

  9. #9
    RiseAndShine's Avatar Member
    Reputation
    18
    Join Date
    Jan 2009
    Posts
    27
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by jbrauman View Post
    Awesome. However I'm doing it the hackish way now and just injecting and doing Interact to it.
    Call me paranoid, but I try to avoid injecting as much as possible ^^
    So what I do is first try to click on an object, if that fails I use interact (and if that fails I use interact again, because sometimes it doesn't work the first time).
    Also yeah, I'm running window mode, that probably explains why it's some pixels off.

  10. #10
    jbrauman's Avatar Member
    Reputation
    65
    Join Date
    Dec 2007
    Posts
    72
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by RiseAndShine View Post
    Call me paranoid, but I try to avoid injecting as much as possible ^^
    So what I do is first try to click on an object, if that fails I use interact (and if that fails I use interact again, because sometimes it doesn't work the first time).
    Also yeah, I'm running window mode, that probably explains why it's some pixels off.
    I was trying to not do injecting too but.. it's so awesome. Can't help myself.

  11. #11
    naa's Avatar Contributor
    Reputation
    100
    Join Date
    Oct 2006
    Posts
    63
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Anyone got the new offsets for 3.0.9? or know how to find them?

  12. #12
    g3gg0's Avatar Active Member
    Reputation
    32
    Join Date
    Mar 2008
    Posts
    86
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    cameraPointer = 0x010A6DAC;
    cameraOffset = 0x000782C;

  13. #13
    naa's Avatar Contributor
    Reputation
    100
    Join Date
    Oct 2006
    Posts
    63
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by g3gg0 View Post
    cameraPointer = 0x010A6DAC;
    cameraOffset = 0x000782C;
    Thank you +Rep

  14. #14
    xLeo123's Avatar Member
    Reputation
    1
    Join Date
    Jan 2009
    Posts
    27
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The float x,y co-ords that are passed onto the function, are they relative to anything? how do the specified co-ordinates translate to on-screen co-ords? thanks.

    E.G: My character is at 48.5,30.6,5.1 XYZ co-ords, and I wanted to click an object at 48.7,30.1,5.2 XYZ, what would the params be on the function?
    0.2f,0.5f,0.1f?
    Last edited by xLeo123; 02-15-2009 at 05:53 AM. Reason: Example

  15. #15
    corderoy's Avatar Member
    Reputation
    7
    Join Date
    May 2008
    Posts
    17
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    they are relative to the centre of the Azeroth

    You should pass 48.7f,30.1f,5.2f

Page 1 of 2 12 LastLast

Similar Threads

  1. [Bot] did sombody know how to move the mouse in NODE.
    By woshixgf in forum Overwatch Exploits|Hacks
    Replies: 3
    Last Post: 07-22-2016, 11:32 AM
  2. [Hack] How does Overwatch Mouse Sensitivity correlate to Moving the mouse with C++?
    By seldane in forum Overwatch Exploits|Hacks
    Replies: 4
    Last Post: 07-09-2016, 12:17 PM
  3. Can the government tax WoW?
    By sidekick2isphat in forum World of Warcraft General
    Replies: 0
    Last Post: 12-13-2006, 04:23 PM
  4. Remember the Autoit for WoW Glider?
    By Kashfox in forum World of Warcraft General
    Replies: 11
    Last Post: 07-20-2006, 06:15 PM
  5. Remember the Autoit for WoW Glider?
    By Kashfox in forum World of Warcraft Bots and Programs
    Replies: 4
    Last Post: 07-19-2006, 08:58 AM
All times are GMT -5. The time now is 06:29 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search