Thread Tools Display Modes
03/13/21, 12:07 AM   #1
marsianna4ka
Join Date: Mar 2021
Posts: 3
Is there a way to get the Z-position of the current character?

The GetMapPlayerPosition function only returns X, Y, heading and the isShownInCurrentMap for the current character. Is it possible to get the Z position of the character? The problem is that now my addon informs that a player is at the destination location, when, for example, he is on a bridge high above that location.

PS sorry for the poor quality English.
  Reply With Quote
03/13/21, 03:13 AM   #2
awfuldead
AddOn Author - Click to view addons
Join Date: Mar 2020
Posts: 17
what about GetUnitWorldPosition('player') ?
  Reply With Quote
03/13/21, 07:02 AM   #3
Sharlikran
 
Sharlikran's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 628
If you get the Z position then keep in mind that is the 3D position. For example say your 2D position is 100,100 the 3D position might be 1000, 1000, 2000. Use Lib3D to do conversions if needed.
  Reply With Quote
03/13/21, 11:09 AM   #4
marsianna4ka
Join Date: Mar 2021
Posts: 3
Originally Posted by awfuldead View Post
what about GetUnitWorldPosition('player') ?
Thank! This function does return the Z coordinate in some strange integer units, but that's not a problem. It is even stranger how this quantity behaves. For example, it changes when moving on a horizontal surface (for example, on water). When descending from the portal of Artaeum to the water, it first decreases from 133k to 126k, and then begins to grow again and at the water level is the same 133k. This is already a problem. I checked the code and there is nowhere to go wrong.

Lua Code:
  1. local _, worldX, worldY, worldZ = GetUnitWorldPosition("player")
  2. d("X: "..worldX)
  3. d("Y: "..worldY)
  4. d("Z: "..worldZ)

Originally Posted by Sharlikran View Post
If you get the Z position then keep in mind that is the 3D position. For example say your 2D position is 100,100 the 3D position might be 1000, 1000, 2000. Use Lib3D to do conversions if needed.
Thank you, I am aware of this. And I'm already using Lib3d to transform coordinates to a more convenient form.

Unfortunately in this game it is not possible to get an unambiguous transformation from 2D coordinates to 3D. There are bridges over the ravines, cliffs can hang over the surface. A person can stand at the top, or maybe at the bottom and have the same 2D coordinate. For an unambiguous transformation, three coordinates are needed. Yes, they can be in other units, they can be in a different basis, even if in a non-orthogonal system. But still there should be three of them.

Lib3D has a GetFirstPersonRenderSpacePosition function that returns the 3D position of the point of view. It would suit me, but it doesn't work on the mount. And this is very important. Why do you need a GPS navigator with which you can only walk? In addition, when called, it gives an error.
  Reply With Quote
03/13/21, 12:29 PM   #5
shira
AddOn Author - Click to view addons
Join Date: Aug 2020
Posts: 3
iirc GetUnitWorldPosition() and GetUnitRawWorldPosition() return (x, z, y) with z being the usual vertical axis
  Reply With Quote
03/21/21, 09:41 AM   #6
marsianna4ka
Join Date: Mar 2021
Posts: 3
Thanks for answers! I will try again. Perhaps I didn’t understand something.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Is there a way to get the Z-position of the current character?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off