calculate object's screen position menu

Shout-Out

User Tag List

Page 1 of 3 123 LastLast
Results 1 to 15 of 37
  1. #1
    wanyancan's Avatar Member
    Reputation
    1
    Join Date
    May 2009
    Posts
    40
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    calculate object's screen position

    This is my first post. Hope it will help someone in making your "undetectable" bot. If people finds this helpful, I'll post more about IsSpellReady and HasAuro.
    With these three functions, it would be much easier to write a bot using ReadMemory function only without injection at all. :wave:

    Code:
    BOOL scrPos(float x, float y, float z, POINT *pt){
    	// return scrpos relative to leftup corner, x positive to right, y positive to downward
    	// to be compatible with MouseClick
    	/* some transformation, by wanyancan.
    		transed := ({
       {1, 0, 0, -camx},
       {0, 1, 0, -camy},
       {0, 0, 1, -camz},
       {0, 0, 0, 1}
      })
    zroted := ({
        {cosY, -sinY, 0, 0},
        {sinY, cosY, 0, 0},
        {0, 0, 1, 0},
        {0, 0, 0, 1}
       }).transed
    xroted := ({
        {1, 0, 0, 0},
        {0, cos[alpha], sin[alpha], 0},
        {0, -sin[alpha], cos[alpha], 0},
        {0, 0, 0, 1}
       }).zroted
    pos := xroted.({
        {myx},
        {myy},
        {myz},
        {1}
       })  = {{-camx cosY + cosY myx + camy sinY - 
       myy sinY}, {cosY myy cos[alpha] + 
       myx sinY cos[alpha] + (-camy cosY - camx sinY) cos[alpha] - 
       camz sin[alpha] + myz sin[alpha]}, {-camz cos[alpha] + 
       myz cos[alpha] - cosY myy sin[alpha] - 
       myx sinY sin[alpha] - (-camy cosY - camx sinY) sin[alpha]}, {1}}
    	*/
    	float camX = ReadFloat(LPCVOID(G_CAMPOS+4)); // camera position
    	float camY = ReadFloat(LPCVOID(G_CAMPOS));
    	float camZ = ReadFloat(LPCVOID(G_CAMPOS+8));
    	float camRotX = ReadFloat(LPCVOID(G_CAMROT));  // camera horizontal direction (0 , 2*pi) north is 0, positive counter-clockwise
    	float camRotY = ReadFloat(LPCVOID(G_CAMROT+4)); // camera vertical direction (-pi/2, pi/2) look upward is positive 
    	float alpha = asinf(camRotX);
    	float cosY = cosf(camRotY);
    	float sinY = sinf(camRotY);
    
    	float pos0 = -camX*cosY+cosY*x+camY*sinY-y*sinY;
    	float pos1 = cosY*y*cosf(alpha)+x*sinY*cosf(alpha)+(-camY*cosY-camX*sinY)*cosf(alpha)-camZ*sinf(alpha) + z*sinf(alpha);
    	float pos2 = -camZ*cosf(alpha)+z*cosf(alpha)-cosY*y*sinf(alpha)-x*sinY*sin(alpha)-(-camY*cosY-camX*sinY)*sin(alpha);
    	if (pos1<0.1)
    		return FALSE;
    	float fov = 3.1415926/2*0.7;  // field of view , view angle is about 0.7
    
    	RECT rect;
    	GetClientRect(wowhwnd, &rect);
    	float modifier = 1.0f;
    	if(1.0*rect.right/rect.bottom>1.5) 
    		modifier *=1.15;  // widescreen modifier
    	float scrX = -pos0/pos1/tanf(fov/2*1.08*modifier) * rect.right/2;
    	float scrY = -pos2/pos1/tanf(fov/2*0.85) * rect.bottom/2;
    
    	//printf("cam (%.1f,%.1f,%.1f), camRot (%.1f,%.1f), obj(%.1f,%.1f,%.1f) scr (%.1f, %.1f)\n", camX, camY, camZ, camRotX, camRotY, x,y,z, scrX, scrY);
    	if (abs(scrX)*3>rect.right || abs(scrY)*3>rect.bottom)
    		return FALSE;  // out of center 1/3 rectangle.
    	pt->x = scrX+rect.right/2; pt->y = scrY+rect.bottom/2;
    	return TRUE;
    }

    calculate object's screen position
  2. #2
    suicidity's Avatar Contributor
    Reputation
    207
    Join Date
    Oct 2006
    Posts
    1,439
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    umm. wow. that's definitely readable.


  3. #3
    mnbvc's Avatar Banned
    Reputation
    120
    Join Date
    Jul 2009
    Posts
    273
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://www.mmowned.com/forums/wow-me...ld-screen.html
    the post by YetiHunter


    a *little* bit easier to understand :P

  4. #4
    wanyancan's Avatar Member
    Reputation
    1
    Join Date
    May 2009
    Posts
    40
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmmm... that's C# version, I think they are the same.
    Now I've got my real question: how to do the opposite thing?
    How to detect the nearest world point in front of the player's eye view? So that the bot can detect whether he's running against a wall(or tree) ?
    I've seen kynox's post about 3d Rendering at Dribble Blog Archive 3D Rendering - Just another WordPress weblog
    Sincerely appreciate anyone who knows how this is done. Or any hints?
    I know that when the camera rotates behind a tree, it will automatically change its position, so I think there should be a function similar to my request.

  5. #5
    b0t001's Avatar Private
    Reputation
    5
    Join Date
    Oct 2009
    Posts
    8
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    wow. what a great first post.

    using this would be a great way to finally have a gatherbot that works in the background without memory writes or injection.

    as for doing the reverse, i'm not sure if it's possible for the use that you've described - because you want to project a 2d pixel selection into a 3d world. without the depth, it's difficult to tell (from the computer's point of view) what the mouse is over.

    since you can just read the player's position and rotation from memory, wouldn't it be easier to check for objects whose coordinates are within a certain area infront of the player?

    (i apologise if this is all rubbish. to me, using a screen to world transformation for checking obstacles doesn't make sense)

  6. #6
    lanman92's Avatar Active Member
    Reputation
    50
    Join Date
    Mar 2007
    Posts
    1,033
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think you would have to parse the loaded models and check collision and position. You could also use TraceLine, with the points being your players location+model height and a position 5-7 yards ahead. No real need for World to Screen or the likes. There's a bit of info a few pages back posted by Apoc

  7. #7
    kynox's Avatar Member
    Reputation
    830
    Join Date
    Dec 2006
    Posts
    888
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by b0t001 View Post
    wow. what a great first post.

    using this would be a great way to finally have a gatherbot that works in the background without memory writes or injection.

    as for doing the reverse, i'm not sure if it's possible for the use that you've described - because you want to project a 2d pixel selection into a 3d world. without the depth, it's difficult to tell (from the computer's point of view) what the mouse is over.

    since you can just read the player's position and rotation from memory, wouldn't it be easier to check for objects whose coordinates are within a certain area infront of the player?

    (i apologise if this is all rubbish. to me, using a screen to world transformation for checking obstacles doesn't make sense)
    [YT]M0MpUJVZrLI[/YT]

    Orlly?
    Last edited by kynox; 01-05-2010 at 01:11 AM.

  8. #8
    wanyancan's Avatar Member
    Reputation
    1
    Join Date
    May 2009
    Posts
    40
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by kynox View Post
    [YT]http://www.youtube.com/watch?v=M0MpUJVZrLI[/YT]

    Orlly?
    Could you confirm that this is done by reading the loaded model files? Is there any quicker or easier method?

  9. #9
    Nesox's Avatar ★ Elder ★
    Reputation
    1280
    Join Date
    Mar 2007
    Posts
    1,238
    Thanks G/R
    0/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i think there's something more to it than that ^^

  10. #10
    kynox's Avatar Member
    Reputation
    830
    Join Date
    Dec 2006
    Posts
    888
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by wanyancan View Post
    Could you confirm that this is done by reading the loaded model files? Is there any quicker or easier method?
    No, its got nothing to do with reading model files. You translate the coordinate, and then use Traceline.

  11. #11
    wanyancan's Avatar Member
    Reputation
    1
    Join Date
    May 2009
    Posts
    40
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    After inspecting the Traceline function, I don't think it's possible to implement the same function in my bot using ReadMemory only...
    I've got two options:
    1. use a really 'safe' injection ... Would anyone share your 'safe' injection codes?
    2. use another movement stuck detection... Simply compare with old XYZ positions
    Any other suggestions?

  12. #12
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1358
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/6
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by wanyancan View Post
    1. use a really 'safe' injection ... Would anyone share your 'safe' injection codes?
    What the **** do you mean "safe injection codes"?

    If your hack is private, you're injected, you call engine functions, and you DONT write to any read-only memory then you're pretty safe.

    Once your hack is public though you need to actively protect yourself against warden.

    You also need Warden protection if you're writing to read-only memory.

    You're still detectable at any rate (public or private) via a stack trace, but very very very few games go that far, and given Blizzard's track record, you should be realistically fairly safe (with the exception of something big like ISXWoW, which they've been known to get pretty low-level for).

    There's no such thing as "safe" vs "unsafe" "injection codes" though in the context you mean it (or rather, the context I'm interpreting you meaning. it's hard to tell exactly because of the language barrier.).

  13. #13
    wanyancan's Avatar Member
    Reputation
    1
    Join Date
    May 2009
    Posts
    40
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Cypher View Post
    What the **** do you mean "safe injection codes"?

    If your hack is private, you're injected, you call engine functions, and you DONT write to any read-only memory then you're pretty safe.

    Once your hack is public though you need to actively protect yourself against warden.

    You also need Warden protection if you're writing to read-only memory.

    You're still detectable at any rate (public or private) via a stack trace, but very very very few games go that far, and given Blizzard's track record, you should be realistically fairly safe (with the exception of something big like ISXWoW, which they've been known to get pretty low-level for).

    There's no such thing as "safe" vs "unsafe" "injection codes" though in the context you mean it (or rather, the context I'm interpreting you meaning. it's hard to tell exactly because of the language barrier.).
    I saw your post http://www.mmowned.com/forums/wow-me...cess-bots.html
    and expecting your reactions... Take it easy...
    What I actually mean is "would you be glad to share your injection methods?". By then it's not your private codes, so the next question is whether it is still safe (at least over two patches duration)?

    I'm currently using ReadMemory only for all the bot logic checks. And I want to keep this style. Is it possible to call remote functions (like Traceline) by passing pointers without using injected dll? I'm not saying injection is bad or evil... it's just not my style.

  14. #14
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1358
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/6
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by wanyancan View Post
    I saw your post http://www.mmowned.com/forums/wow-me...cess-bots.html
    and expecting your reactions... Take it easy...
    What I actually mean is "would you be glad to share your injection methods?". By then it's not your private codes, so the next question is whether it is still safe (at least over two patches duration)?

    I'm currently using ReadMemory only for all the bot logic checks. And I want to keep this style. Is it possible to call remote functions (like Traceline) by passing pointers without using injected dll? I'm not saying injection is bad or evil... it's just not my style.
    Injection methods? HOW you inject has ZERO bearing on detectability (unless you manually map). Hence, there's nothing to share, open source DLL injecting code has already been posted here. I've posted my code a while back, others have posted theirs.

    Also, what do you mean "is it safe"? I'm pretty sure I've already addressed that both here and in the thread you've linked. ****ing read what I've already written, I'm not going to force-feed it to you.

    Sigh, next... what do you mean is it possible to call Traceline by 'passing pointers'? You need to either use a remote thread (see: CreateRemoteThread) or inject a DLL.

    The remote thread approach though is ugly, because of the possibility of race conditions which you need to address.

    Just inject a DLL and run code in the main thread, you'll save yourself a lot of time and hassle.

  15. #15
    wanyancan's Avatar Member
    Reputation
    1
    Join Date
    May 2009
    Posts
    40
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Aha! CreateRemoteThread is exactly what I'm asking for! Thanks Cypher!
    I think there's no big deal of race conditions for TraceLine function. I'll give it a kick and see how it goes.

Page 1 of 3 123 LastLast

Similar Threads

  1. Replies: 0
    Last Post: 09-08-2016, 07:16 AM
  2. 3.3.5 ObjectManager questions relating setting position of objects
    By felixdabayer in forum WoW Memory Editing
    Replies: 5
    Last Post: 08-12-2012, 10:28 AM
  3. How to get a spell Object's target and position?
    By demonguy in forum WoW Memory Editing
    Replies: 24
    Last Post: 05-29-2012, 11:39 PM
  4. Burning Crusade Screen Shots
    By Bossman4 in forum World of Warcraft General
    Replies: 4
    Last Post: 05-18-2006, 08:58 PM
  5. [Trick] WSG Safe Flag Holding Position
    By Matt in forum World of Warcraft Exploits
    Replies: 4
    Last Post: 05-10-2006, 06:17 PM
All times are GMT -5. The time now is 12:30 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