[WoW] 1.12.1.5875 Info Dump Thread menu

User Tag List

Page 40 of 41 FirstFirst ... 363738394041 LastLast
Results 586 to 600 of 614
  1. #586
    badusername1234's Avatar Active Member
    Reputation
    26
    Join Date
    Apr 2017
    Posts
    47
    Thanks G/R
    18/6
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by dreadcraft View Post
    Code:
    0 == local player might be outdoors but isn't necessarily so
    i heard rand() is pretty good too

    [WoW] 1.12.1.5875 Info Dump Thread
  2. #587
    danwins's Avatar Contributor
    Reputation
    189
    Join Date
    Mar 2013
    Posts
    143
    Thanks G/R
    6/62
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by dreadcraft View Post
    Indoors Offset:
    Code:
    // offset is boolean, 1 == local player is indoors, 0 == local player might be outdoors but isn't necessarily so
    // where WoW.exe = 0x400000 or your wow module base address
    WoW.exe + 0x468608
    WoW.exe + 0x706D44
    WoW.exe + 0x8EAA60
    WoW.exe + 0x7C8300
    Just thought I would share this quick tidbit lads. I couldn't find an equivalent for 1.12 by searching so I thought I would share.
    I'm using it to allow my bot to mount in BG's.
    It's not perfect for this but if you add some additional checks, eg. track the distance you've covered since you were last indoors, it can be useful.
    You can probably also use it for casting entangling roots and using travel form, etc.

    Unfortunately I don't have any version of IDA or HexRays so I can't tell you exactly which of these offsets relates to what, but personally I am using 0x468608 as it is updated most frequently by the client in my tests. If someone has a better alternative to these or more information from an IDB please feel free to piggy-back.
    Code:
    WoW.exe + 0x468608 s_indoors     // HandleIndoorZoneChange
    WoW.exe + 0x706D44               // sound ambience related
    WoW.exe + 0x8EAA60 s_isInside    // used for minimap stuff
    WoW.exe + 0x7C8300               // also minimap related referenced in CGMinimapFrame::Render

  3. #588
    zsuperman's Avatar Member
    Reputation
    1
    Join Date
    Sep 2018
    Posts
    1
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Never mind
    Last edited by zsuperman; 09-23-2018 at 12:17 PM.

  4. #589
    xashh's Avatar Member
    Reputation
    1
    Join Date
    Oct 2018
    Posts
    4
    Thanks G/R
    2/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    anybody got any tips for finding lua_setfield? im thinking of trying to search for xrefs to something like lua_pushcclosure and looking at functions that r called after it

    nevermind! i just read about it in the lua docs and ill just use something like this guy instead
    Code:
      void setfield (const char *index, int value) {
          lua_pushstring(L, index);
          lua_pushnumber(L, (double)value/MAX_COLOR);
          lua_settable(L, -3);
        }
    Programming in Lua : 25.1
    Last edited by xashh; 12-17-2018 at 12:32 PM.

  5. #590
    DarkLinux's Avatar Former Staff
    CoreCoins Purchaser Authenticator enabled
    Reputation
    1584
    Join Date
    May 2010
    Posts
    1,829
    Thanks G/R
    188/531
    Trade Feedback
    16 (100%)
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    Code:
    LoadModel = 0x00706A50
    ...
    BoxCollide = 0x006AC060
    CurrentBoundingBox = 0x00C4E5A0
    BoxCollide_CollisionInfo = 0x00BE0F54
    Has anyone gotten BoxCollide to work? I think I have the correct offsets. Going to look into it more, just seeing if anyone else has it working.

  6. #591
    boipus's Avatar Active Member
    Reputation
    25
    Join Date
    Apr 2018
    Posts
    4
    Thanks G/R
    2/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Anyone able to shed some more light on world2screen? It seems the x position is correct but the y is doing weird stuff.

    Please excuse the mess - still just trying to get it working. Also if anyone has an easy way to get the wow window that would be helpful - im currently using GetActiveWindow() so if i alt tab the drawing stops.

    Code:
    static auto const WorldToScreen = reinterpret_cast<bool(__thiscall *)(
    	DWORD framePtr, C3Vector* c3Struct, C3Vector* c2Struct)>(Offsets::FunctionOffsets::WorldToScreen); // 0x483EE0
    Code:
    		if (liteMgrr->Target != NULL) {
    			
    			C3Vector targetPos;
    			auto targLoc = liteMgrr->Target->GetLocation();
    			targetPos.x = *targLoc.X;
    			targetPos.y = *targLoc.Y;
    			targetPos.z = *targLoc.Z;
    
    			drawVector = WorldToScreen(framePtr, &targetPos, &drawPos);
    
    			RECT windowRect;
    
    			bool findScreen = GetWindowRect(GetActiveWindow(), &windowRect);
    			if (findScreen  && drawVector) {
    				float width = windowRect.right - windowRect.left; // left is always zero
    				float height = windowRect.bottom - windowRect.top; // top is always zero
    
    				drawPos.x = (drawPos.x * width); // This seems right, it is really close
    				drawPos.y = height -(drawPos.y * (height *2)); // This is the closest
                                    //drawPos.y = height -(drawPos.y * height); // This initially looked like the inverse
                                    // Draw code happens later but same frame
    			}
    			else {
    				drawVector = false;
    			}
    		}
    After looking at some snippets for later expacs (Jadds is floating around), I went looking and have found DDCToNDC at 0x41ADE0, but am still looking into it - the function in 1.12.1 seems different.

    Untitled.jpg

  7. #592
    Icesythe7's Avatar Contributor
    Reputation
    231
    Join Date
    Feb 2017
    Posts
    168
    Thanks G/R
    10/111
    Trade Feedback
    0 (0%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by boipus View Post
    don't use get window rect that will throw it off you should be using getclientrect something like this

    PHP Code:
    private static bool SetOverlayPosition(string appName)
            {
                var 
    hwnd Process.GetProcessesByName(appName).FirstOrDefault().MainWindowHandle;
                if (
    hwnd == IntPtr.Zero) return false;

                
    GetClientRect(hwndout var test);
                var 
    top = new Point();
                
    ClientToScreen(hwndref top);
                
    Overlay.Resize(top.Xtop.Ytest.Right test.Lefttest.Bottom test.Top);
                return 
    true;
            } 
    notice with getclientrect it properly overlays the window without the tittlebars (the red lines are the fake overlay window borders


    notice the difference here with getwindowrect it gets the tittlebar and the invisible borders from windows 10


    iswindowtopmost maybe would be better u can use the main window handle like the above code does for this (idk how ur overlaying so this may always return false because of ur overlay window u will have to test)

    PHP Code:
    [DllImport("user32.dll"SetLastError=true)]
    static 
    extern int GetWindowLong(IntPtr hWndint nIndex);

    const 
    int GWL_EXSTYLE = -20;
    const 
    int WS_EX_TOPMOST 0x0008;

    public static 
    bool IsWindowTopMost(IntPtr hWnd)
    {
        
    int exStyle GetWindowLong(hWndGWL_EXSTYLE);
        return (
    exStyle WS_EX_TOPMOST) == WS_EX_TOPMOST;

    Last edited by Icesythe7; 03-12-2019 at 09:23 AM.

  8. Thanks boipus (1 members gave Thanks to Icesythe7 for this useful post)
  9. #593
    boipus's Avatar Active Member
    Reputation
    25
    Join Date
    Apr 2018
    Posts
    4
    Thanks G/R
    2/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Got it fixed, two issues in the end.

    1. As Icesythe7 said getwindowrect was off - got the hWnd from (LPDIRECT3DDEVICE9)pDevice->GetCreationParameters
    2. DDCtoNDC seems to fix the rest of the allignment issues

    Code:
    // at 0x41ADE0
    void __fastcall DDCToNDC(float *pfParm1,float *pfParm2,float param_1,float param_2)
    
    {
      if (pfParm1 != (float *)0x0) {
        *pfParm1 = param_1 / _DAT_00832a44;
      }
      if (pfParm2 != (float *)0x0) {
        *pfParm2 = param_2 / _DAT_00832a48;
      }
      return;
    }
    and if anyone else needs a template for world to screen

    Code:
    // uint __thiscall GetScreenCoordinates(int iParm1,float param_1,float *param_2) // 1.12.1 
    drawVector = WorldToScreen(framePtr, &targetPos, &drawPos);
    
    RECT windowRect;
    
    bool noVal = GetClientRect(clientHwnd, &windowRect);
    if (noVal && drawVector) {
    	float x, y;
    	DDCToNDC(&x, &y, drawPos.x, drawPos.y);
    	float width = windowRect.right - windowRect.left;
    	float height = windowRect.bottom - windowRect.top;
    
    	drawPos.x = (x * width);
    	drawPos.y = height -(y * height);
    }
    fixed.jpg
    Last edited by boipus; 03-13-2019 at 09:06 AM. Reason: added img

  10. Thanks Corthezz (1 members gave Thanks to boipus for this useful post)
  11. #594
    Icesythe7's Avatar Contributor
    Reputation
    231
    Join Date
    Feb 2017
    Posts
    168
    Thanks G/R
    10/111
    Trade Feedback
    0 (0%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    hmm I'm having a hard time with this function aswell

    Code:
    	ImVec2 WorldToScreen(Reclass::Vector3 inPos)
    	{
    		auto io = ImGui::GetIO();
    		ImVec2 tempOut;
    		if (reinterpret_cast<bool(__thiscall*)(uintptr_t framePtr, Reclass::Vector3* posIn, ImVec2* screenPosOut)>(0x483EE0)(*reinterpret_cast<uintptr_t*>(0xB4B2BC), &inPos, &tempOut))
    		{
    			tempOut.x = tempOut.x / 0.8715755343 * io.DisplaySize.x;
    			tempOut.y = io.DisplaySize.y - tempOut.y / 0.4902612269 * io.DisplaySize.y;
    			return tempOut;
    		}
    		return ImVec2(-1, -1);
    	}
    nvm had an address wrong is working now ^ (if u dont want to use ddctondc)

    Last edited by Icesythe7; 03-16-2019 at 12:00 AM.

  12. #595
    someone_else's Avatar Member
    Reputation
    8
    Join Date
    Mar 2019
    Posts
    2
    Thanks G/R
    2/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    full python 3 implementation of a world to screen viewer of game object coordinates for version 1.12.1
    it might not work for other resolutions than 1920x1080

    Code:
    """
    Made for wow 1.12.1.5875, python>=3.6
    
    ````sh
    $ pip install pypiwin32==224 Pymem==1.0 psutil mss numpy matplotlib
    ```
    
    # Links
    
    ### Fishbot
    https://github.com/WowDevs/Fishbot-1.12.1/blob/fd3855845ae12e32ca5477526017b0b9ee680b9c/FishBot%201.12.1/GUI/MainWindow.cs
    https://github.com/WowDevs/Fishbot-1.12.1/blob/fd3855845ae12e32ca5477526017b0b9ee680b9c/FishBot%201.12.1/Helpers/Offsets.cs?ts=4
    https://github.com/WowDevs/Fishbot-1.12.1/blob/fd3855845ae12e32ca5477526017b0b9ee680b9c/FishBot%201.12.1/Hook/Hook.cs?ts=4
    
    ### WowObjects / offsets
    https://www.ownedcore.com/forums/world-of-warcraft/world-of-warcraft-bots-programs/wow-memory-editing/208754-guide-kind-of-how-i-handle-objects.html
    https://www.ownedcore.com/forums/world-of-warcraft/world-of-warcraft-bots-programs/wow-memory-editing/328263-wow-1-12-1-5875-info-dump-thread-3.html#post2436167
    https://www.ownedcore.com/forums/world-of-warcraft/world-of-warcraft-bots-programs/wow-memory-editing/328263-wow-1-12-1-5875-info-dump-thread-29.html#post3680708
    https://www.ownedcore.com/forums/world-of-warcraft/world-of-warcraft-bots-programs/wow-memory-editing/328263-wow-1-12-1-5875-info-dump-thread-38.html#post3859175
    
    # world to screen
    ### First attempt
    https://www.ownedcore.com/forums/world-of-warcraft/world-of-warcraft-bots-programs/wow-memory-editing/599004-world-screen.html#post3661355
    
    ### Second attempt
    https://www.ownedcore.com/forums/world-of-warcraft/world-of-warcraft-bots-programs/wow-memory-editing/535748-world-screen.html#post3347571
    
    ### Third Attempt
    https://www.ownedcore.com/forums/world-of-warcraft/world-of-warcraft-bots-programs/wow-memory-editing/271612-world-screen.html#post1754193
    
    ### Misc
    https://www.ownedcore.com/forums/world-of-warcraft/world-of-warcraft-bots-programs/wow-memory-editing/328263-wow-1-12-1-5875-info-dump-thread-40.html#post4022185
    https://www.ownedcore.com/forums/world-of-warcraft/world-of-warcraft-bots-programs/wow-memory-editing/544312-12-1-2016-bans-3.html#post3386119
    
    """
    
    import numpy as np
    import pymem
    import psutil
    import mss
    import matplotlib.pyplot as plt
    
    MAGIC_SCALE_FACTOR = 1 / 1.10 # TODO: Find the real formula
    SCREEN_SIZE = 1920, 1080 # TODO: Find in memory
    
    class Offset:
        player_name = 0x827D88
        obj_manager = 0x00741414
        camera = 0x0074B2BC
    
        class ObjectManager:
            first_obj = 0xAC
    
        class Object:
            type = 0x14
            next = 0x3C
    
        class GameObject:
            guid = 0x30
            name1 = 0x214
            name2 = 0x8
            xyz = 0x248
    
        class Camera:
            offset = 0x65B8
            xyz = 0x8
            facing = xyz + 3 * 4
            fov = xyz + 14 * 4
            aspect = xyz + 15 * 4
    
    class WoW:
        def __init__(self, pid=None):
            if pid is None:
                pid, = [ps.pid for ps in psutil.process_iter() if ps.name() == 'WoW.exe']
    
            pm = pymem.Pymem()
            pm.open_process_from_id(pid)
            self.pid = pid
            self.pm = pm
    
            mod, = [mod for mod in pm.list_modules() if mod.name == 'WoW.exe']
            base_address = mod.lpBaseOfDll
            obj_mgr_addr = pm.read_uint(base_address + Offset.obj_manager)
            first_obj_addr = pm.read_uint(obj_mgr_addr + Offset.ObjectManager.first_obj)
    
            self.mod = mod
            self.base_address = base_address
            self.player_name = pm.read_string(self.base_address + Offset.player_name)
            self.first_obj_addr = first_obj_addr
    
        def pull_floats(self, addr, shape):
            a = np.empty(shape, 'float32')
            for i, idxs in enumerate(np.ndindex(*shape)):
                a[idxs] = self.pm.read_float(addr + i * 4)
            return a.astype('float64')
    
        def gen_objects(self):
            obj_addr = self.first_obj_addr
            while True:
                if not (obj_addr != 0 and obj_addr & 0x1 == 0):
                    break
                yield obj_addr
                next_addr = self.pm.read_uint(obj_addr + Offset.Object.next)
                if next_addr == obj_addr:
                    break
                obj_addr = next_addr
    
        def gen_game_objects(self):
            for obj_addr in self.gen_objects():
                if self.pm.read_int(obj_addr + Offset.Object.type) == 5:
                    yield GameObject(self, obj_addr)
    
    class Camera():
        def __init__(self, w):
            cam0 = w.pm.read_uint(w.base_address + Offset.camera)
            cam1 = w.pm.read_uint(cam0 + Offset.Camera.offset)
    
            self.xyz = w.pull_floats(cam1 + Offset.Camera.xyz, (3,))
            self.facing = w.pull_floats(cam1 + Offset.Camera.facing, (3, 3))
            self.fov = w.pull_floats(cam1 + Offset.Camera.fov, ())
            self.aspect = w.pull_floats(cam1 + Offset.Camera.aspect, ())
            self.size = np.asarray(SCREEN_SIZE)
            assert np.allclose(self.aspect, np.divide.reduce(self.size.astype(float)))
    
        def world_to_screen(self, xyz):
            diff = xyz - self.xyz
            """
            At this point:
            - Origin is the center of the screen
            - Unit vector is a yard long
            - Axes are right handed
                   z-axis (sky)
                      ^
                      |  7 x-axis (north)
                      | /
             y-axis   |/
              <-------+
            (west)
            """
    
            view = diff @ np.linalg.inv(self.facing)
            """
            At this point:
            - Origin is the center of the screen
            - Unit vector is ~a yard long
            - Axes are right handed
                   z-axis (top of the screen)
                      ^
                      |  7 x-axis (depth)
                      | /
             y-axis   |/
              <-------+
            (left of the screen)
            """
    
            cam = np.asarray([-view[1], -view[2], view[0]])
            """
            At this point:
            - Origin is the center of the screen
            - Unit vector is a yard long
            - Axes are right handed
                7 z-axis (depth)
               /
              /      x-axis
             +--------->
             |    (right of the screen)
             |
             |
             v  y-axis
            (bottom of the screen)
            """
    
            fov_x = (1 / (1 + 1 / self.aspect ** 2)) ** 0.5
            fov_y = fov_x / self.aspect
            fov_x *= self.fov
            fov_y *= self.fov
            fov_x *= MAGIC_SCALE_FACTOR
    
            screen_right_at_unit_depth = np.tan(fov_x / 2)
            screen_bottom_at_unit_depth = np.tan(fov_y / 2)
    
            screen_right_at_point_depth = screen_right_at_unit_depth * cam[2]
            screen_bottom_at_point_depth = screen_bottom_at_unit_depth * cam[2]
    
            screen = np.asarray([
                cam[0] / screen_right_at_point_depth,
                cam[1] / screen_bottom_at_point_depth,
            ])
            """
            At this point:
            - Origin is the center of the screen
            - Unit vector is half of the screen
                     x-axis
             +--------->
             |    (right of the screen)
             |
             |
             v  y-axis
            (bottom of the screen)
            """
    
            raster = self.size / 2 * (1 + screen)
            """
            At this point:
            - Origin is the top left of the screen
            - Unit vector is a pixel
                     x-axis
             +--------->
             |    (right of the screen)
             |
             |
             v  y-axis
            (bottom of the screen)
            """
    
            behind = cam[2] < 0
            in_fov = np.all(np.abs(screen) <= 1) and not behind
            return raster, in_fov, behind
    
    class GameObject:
        def __init__(self, w, addr):
            assert w.pm.read_int(addr + Offset.Object.type) == 5
            self.addr = addr
            a = addr
            a += Offset.GameObject.name1
            a = w.pm.read_uint(a)
            a += Offset.GameObject.name2
            a = w.pm.read_uint(a)
            self.name = w.pm.read_string(a)
            self.xyz = w.pull_floats(addr + Offset.GameObject.xyz, (3,))
    
    w = WoW()
    cam = Camera(w)
    
    print('  Snapping...')
    with mss.mss() as sct:
        monitor = sct.monitors[1]
        img = sct.grab(monitor)
        img = np.asarray(img)[:, :, [2, 1, 0]]
        print('  Snaped!', img.shape)
    
    fig = plt.figure()
    ax = fig.add_subplot(111)
    ax.imshow(img)
    
    for go in list(w.gen_game_objects()):
    
        x, y, z = go.xyz
        ox = x - cam.xyz[0]
        dx = ['south', 'north'][int(ox > 0)]
        oy = y - cam.xyz[1]
        dy = ['east', 'west'][int(oy > 0)]
    
        print(f'{go.name:>30}: ('
              f'{ox:+7.2f}({dx})({x:<10.2f}), '
              f'{oy:+7.2f}({dy})({y:<10.2f}), '
              f'{z - cam.xyz[2]:+7.2f}({z:<10.2f})), '
        )
    
        (x, y), in_fov, behind = cam.world_to_screen(go.xyz)
        print('>', x, y, in_fov, behind)
    
        if in_fov:
            ax.annotate(go.name, xy=(x, y), xytext=(x - 150, y + 150),
                arrowprops=dict(facecolor='black', shrink=0.005))
    
    plt.show()
    plt.close('all')

    Figure_wow.jpg

  13. Thanks Corthezz, Icesythe7 (2 members gave Thanks to someone_else for this useful post)
  14. #596
    djanius's Avatar Member
    Reputation
    9
    Join Date
    Nov 2009
    Posts
    12
    Thanks G/R
    4/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello guys. Please tell me how i can get the time that character spent in game? Maybe someone has the address where this data is stored.
    Thank you in advance. And i apologize for my english.

  15. #597
    Icesythe7's Avatar Contributor
    Reputation
    231
    Join Date
    Feb 2017
    Posts
    168
    Thanks G/R
    10/111
    Trade Feedback
    0 (0%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by djanius View Post
    Hello guys. Please tell me how i can get the time that character spent in game? Maybe someone has the address where this data is stored.
    Thank you in advance. And i apologize for my english.
    I'm not positive but I would imagine that data is stored on the server, so you would have to just run an lua command or something similar to retrieve it.

  16. #598
    nopz's Avatar Active Member
    Reputation
    67
    Join Date
    Aug 2009
    Posts
    56
    Thanks G/R
    1/3
    Trade Feedback
    0 (0%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hey ! nice to see pymem beeing used here !

    (btw I'm the author of pymem).
    My blog: https://pimpmykitty.wordpress.com
    PyFasm: https://github.com/srounet/pyfasm
    Pymem: https://github.com/srounet/pymem

  17. Thanks h42 (1 members gave Thanks to nopz for this useful post)
  18. #599
    NoxiaZ's Avatar Active Member
    Reputation
    23
    Join Date
    May 2019
    Posts
    101
    Thanks G/R
    21/12
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    Anyone who can help with a function that can find the angle between the player and the target position. - What i want, is to figure out if the bot needs to go left or right to face its target, but i have actually no idea how to do that.

    I have created the WorldToScreen function in C#, based on the python code, which is working perfectly.

    Code:
    public ScreenModel WorldToScreen(Vector3 unitPosition)
    {
        var diff = unitPosition - Position;
        Matrix4x4 invertedMatrix;
        Matrix4x4.Invert(Facing, out invertedMatrix);
        var view = Vector3.Transform(diff, invertedMatrix);
        var cam = new Vector3(-view.Y, -view.Z, view.X);
        var fovx = Math.Pow((1 / (1 + 1 / Math.Pow(Aspect, 2))), 0.5);
        var fovy = fovx / Aspect;
        fovx *= Fov;
        fovy *= Fov;
        fovx *= 1 / 1.10;
        var screen_right_at_unit_depth = Math.Tan(fovx / 2);
        var screen_bottom_at_unit_depth = Math.Tan(fovy / 2);
        var screen_right_at_point_depth = screen_right_at_unit_depth * cam.Z;
        var screen_bottom_at_point_depth = screen_bottom_at_unit_depth * cam.Z;
        var screen = new Vector2((float)(cam.X / screen_right_at_point_depth), (float)(cam.Y / screen_bottom_at_point_depth));
        var raster = ScreenSize / 2 * (Vector2.One + screen);
        var behind = cam.Z < 0;
        var infov = Math.Abs(screen.X) <= 1 && Math.Abs(screen.Y) <= 1 && !behind;
        var model = new ScreenModel();
        model.Point = raster;
        model.IsBehind = behind;
        model.IsInFov = infov;
        return model;
    }

  19. #600
    namreeb's Avatar Legendary

    Reputation
    658
    Join Date
    Sep 2008
    Posts
    1,023
    Thanks G/R
    7/215
    Trade Feedback
    0 (0%)
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by NoxiaZ View Post
    Hi,
    Anyone who can help with a function that can find the angle between the player and the target position. - What i want, is to figure out if the bot needs to go left or right to face its target, but i have actually no idea how to do that.

    I have created the WorldToScreen function in C#, based on the python code, which is working perfectly.

    Code:
    public ScreenModel WorldToScreen(Vector3 unitPosition)
    {
        var diff = unitPosition - Position;
        Matrix4x4 invertedMatrix;
        Matrix4x4.Invert(Facing, out invertedMatrix);
        var view = Vector3.Transform(diff, invertedMatrix);
        var cam = new Vector3(-view.Y, -view.Z, view.X);
        var fovx = Math.Pow((1 / (1 + 1 / Math.Pow(Aspect, 2))), 0.5);
        var fovy = fovx / Aspect;
        fovx *= Fov;
        fovy *= Fov;
        fovx *= 1 / 1.10;
        var screen_right_at_unit_depth = Math.Tan(fovx / 2);
        var screen_bottom_at_unit_depth = Math.Tan(fovy / 2);
        var screen_right_at_point_depth = screen_right_at_unit_depth * cam.Z;
        var screen_bottom_at_point_depth = screen_bottom_at_unit_depth * cam.Z;
        var screen = new Vector2((float)(cam.X / screen_right_at_point_depth), (float)(cam.Y / screen_bottom_at_point_depth));
        var raster = ScreenSize / 2 * (Vector2.One + screen);
        var behind = cam.Z < 0;
        var infov = Math.Abs(screen.X) <= 1 && Math.Abs(screen.Y) <= 1 && !behind;
        var model = new ScreenModel();
        model.Point = raster;
        model.IsBehind = behind;
        model.IsInFov = infov;
        return model;
    }
    I don't think you need to do world-to-screen to make that decision. If you look at their position relative to yours you should be able to determine what angle you should be facing. And then you just figure out if turning right or left will get you to that orientation more quickly.

Page 40 of 41 FirstFirst ... 363738394041 LastLast

Similar Threads

  1. [WoW][3.3.5.12340] Info Dump Thread
    By Nesox in forum WoW Memory Editing
    Replies: 83
    Last Post: 04-28-2018, 03:32 PM
  2. [WoW][4.0.3.13329] Info Dump Thread
    By TOM_RUS in forum WoW Memory Editing
    Replies: 73
    Last Post: 02-06-2011, 06:37 AM
  3. [WoW][4.0.1.13164] Info Dump Thread
    By Seifer in forum WoW Memory Editing
    Replies: 29
    Last Post: 01-18-2011, 09:14 AM
  4. [WoW][4.0.1.13205] Info Dump Thread
    By DrGonzo in forum WoW Memory Editing
    Replies: 12
    Last Post: 11-11-2010, 02:34 PM
  5. [WoW][3.3.3.11723] Info Dump Thread
    By miceiken in forum WoW Memory Editing
    Replies: 2
    Last Post: 03-27-2010, 04:42 PM
All times are GMT -5. The time now is 02:42 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search