5E Product Walkthrough Playlist
  1. #1

    Token coordinates in 3 space

    Hi Zacchaeus,

    I am not sure where to ask this question as it is a technical one about FGU internals, but not related to the latest beta.

    Does the x, y position of a token tell me the exact center of the token measured in DistanceUnitsPerGrid?
    Does the "space" of a token tell me the linear dimension of the token in those same units?
    Should I assume that all tokens are cubes in three dimensions?
    Does the default 0 altitude position of a token have the bottom of the cube at 0 in the z direction and the top at "space"?
    I am looking to more accurately calculate the closest points between two cubic tokens at differing altitudes to determine melee and spell aura range estimates.



  2. #2
    Zacchaeus's Avatar
    Join Date
    Dec 2014
    I moved this to House of Healing since it's not really a How to question for the thread you posted in.

    I don't know the answers. I believe that measurements are from the centre of the grid square that the token is in or possibly the token itself. I don't think FG worries about a z axis only x and y.
    If you need to contact customer support or if there is something that you would like to see in Fantasy Grounds that isn't currently part of the software or if there is something you think would improve a ruleset then add your idea here http://fgapp.idea.informer.com/

  3. #3
    1. The tokeninstance.getPosition API always returns the center point of the token on the map. This position is completely independent of grid sizes and distance parameters.

    2. The "space" field of a token is a concept in the rulesets to represent the space taken up by a token. This space data is translated into a "grid size" that is applied to a tokeninstance via an API. (i.e. grid size = 1 for Medium and smaller creatures; grid size = 2 for Large; etc.) The grid size controls how distance measurements between tokens are performed, as well as how underlays are drawn (faction, reach, etc.)

    3. The current API does not provide a mechanism to specify token "height of object" nor "height relative to ground". There is a community extension that adds a height widget display and mechanism for changing. I've thought about this a bit in the past. Most game systems do not provide explicit rules around creature height "grid size"; so I would probably assume cubic creature sizes for measurements, if I did implement.

    4. See answer above.

    5. Any calculations for determining "closest cube" would have to be done on your own. It would most likely look something like this:
    * Project a line between the center points of each token (where center point includes the z-axis half height of cube)
    * Determine the intersection of where the line intersects one of the planes defined by the "cubes" around both source and target creatures
    * For each creature, determine which of the "sub-cubes" (as defined by grid size where each sub-cube is 1x1x1) within the overall creature cube (which can be larger than 1x1x1) is closest to the intersection point.
    * Measure the absolute distance between the sub-cube center points
    * Apply the image / game system specific measurements per grid unit (distance per grid, how diagonals are measured via game vs. raw option, distance units)

    My suggestion is to look at the current community extension project, and see if it does what you need already.


  4. #4

  5. #5
    imagecontrol =="image", x,y,w,h == 21, 99, 585, 292
    gridSize == 15pixels, OffsetX == 2, OffsetY == 1
    source == Aarakocra(a 5' medium token)
    sourceX == 879.5,sourceY = 1253.5

    Offset: the non-negative offset of the first grid square inthe top left corner of the image in pixels.
    position: coordinates the token is located at, relative to theorigin of the image in pixels.
    Therefore the offset should be subtracted from the coordinates to get image grid coordinates in pixels.
    Tokens should be centered in grid squares.
    sourceGridX ==(879.5 - 2)/15=58.5 , sourceGridY == (1253.5 - 1)/15=83.5


    Thanks Moon.

  6. #6
    I have been talking with my physicist son and I believe we have an accurate way to use your extension to have getDistanceBetween correctly calculate the distance in 3d grid cubes from the outermost limits of cubical tokens aligned to a 5' grid and accurate to the nearest pixel (1/15 of a grid cube on the DotMM map). in 5E Cubes that touch or overlap would have a distance of 0, cubes that are separated in x or y or z by 5' would have a distance of 5', etc.

    I will share it with you.

  7. #7
    GKEnialb's Avatar
    Join Date
    Jul 2017
    Castle Rock, CO
    In 5E (and all systems, actually), tokens that are adjacent have a distance of 5', not 0', so the center of the tokens is the most accurate. Most rulesets further complicate things by approximating tokens further apart, though actual measurements can be given by setting the Raw Distances flag on a map (or the "raw" diagonal measurement in 5E).

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Starfinder Playlist

Log in

Log in