-
Private
Coordinate Offset Issues
I've been lurking around here for a bit now and I seem to have stumbled on to an issue that I don't quite understand. I was hoping that my first post wouldn't be a "PLEASE HALP!" one, but here we are. I've done my best to make sense of it, but it seems there is some fundamental flaw in my understanding.
I am iterating through an object manager and trying to pull object and player coordinates and eventually to create a map from the data, but I am having issues with the player objects.
Code:
MemoryReader mem = new MemoryReader();
Process Wow = Process.GetProcessesByName("Wow")[0];
IntPtr Handle = Wow.Handle;
UInt64 Base = (UInt64)Wow.MainModule.BaseAddress;
UInt32 curMgr = (UInt32)mem.ReadInt32(Convert.ToInt32(Base + 0xCB47C4), Handle);
uint nextObj = (UInt32)mem.ReadInt32(curMgr + 0x4, Handle);
uint curObj = (UInt32)mem.ReadInt32(curMgr + 0xC, Handle); //This is the first object
while (curObj != 0x0 && (curObj & 1) == 0)
{
int ot = mem.ReadInt32(curObj + 0xC, Handle);
if (ot == 4)
{ label1.Text += "Object: " + curObj.ToString("X") + "\n\r" +
"X: " + mem.ReadFloat(curObj + 0xF8, Handle).ToString() + "\n\r" +
"Y: " + mem.ReadFloat(curObj + 0xFC, Handle).ToString() + "\n\r" +
"Z: " + mem.ReadFloat(curObj + 0x100, Handle).ToString() + "\n\r";
}
if (ot == 5)
{ label1.Text += "Object: " + curObj.ToString("X") + "\n\r" +
"X: " + mem.ReadFloat(curObj + 0xF8, Handle).ToString() + "\n\r" +
"Y: " + mem.ReadFloat(curObj + 0xFC, Handle).ToString() + "\n\r" +
"Z: " + mem.ReadFloat(curObj + 0x100, Handle).ToString() + "\n\r";
}
curObj = (UInt32)mem.ReadInt32(curObj + nextObj + 0x4, Handle);
}
The memory reader is a custom creation, but seems to be working just fine for my current needs.
Anyways, my issue is that GameObjects (where the object type is 5) return accurate X,Y,Z coordinates, but Players (where the object type is 4) do not. Generally X and Z are populated, but with small numbers which do not correlate to map references.
Am I using the wrong offsets for Players?
-
Contributor
try:
x = 0x838
y = 0x83c
z = 0x840
r = 0x848
-
Private
I'm not sure how I missed that. For anyone else who has the problem, I was using the Object offsets. I should have been using the Unit offsets for position.
Thank you so much for your help.
-
Post Thanks / Like - 1 Thanks
para_ (1 members gave Thanks to Disorderly06 for this useful post)