Results 1 to 4 of 4

Thread: Isometric - sub-position

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Posts
    225

    Isometric - sub-position

    Hiyas,

    I'm trying to figure out how to convert a X/Y position within an isometric tile to a blit position.

    For example.....a bullet is currently at the point 10.2,13.7 on a map. If you take away the main integer portions, you get the position 0.2/0.7 (approx. bottom left on a grid) in a 1x1 square...

    Now, if I have a 40x19 pixel isometric tile, where 0,0 is represented at the middle top, 1,0 is represented at the middle right, 0,1 is represented at the middle left, and 1,1 is represented at the middle bottom, how do I find where on this 40x19 pixel grid the bullet would be?

    If you don't have a clue what I'm on about, imagine a position within a grid tile (eg. 0.3, 0.9), and how you would retrieve that as an x/y position of an isometric tile. (here's hoping that explained it in a nutshell )

    I tried to write some code to do this, but I totally lost track of how I was trying to solve the problem....heh.

    Thanks for any help!

    -Git

  2. #2
    Member
    Join Date
    Jul 2001
    Location
    Minneapolis, MN USA
    Posts
    32
    Hey Git ...

    There's a GameDev.Net article that has helped me get my brain wrapped around isometric theory ... it's found here: http://www.gamedev.net/reference/art...rticle1269.asp

    Here's a quote from it about doing the math:

    Converting from space coordinates (x,y,z) to a pixel coordinate (x',y') in the projection requires only trivial goniometry. The table below presents the formulae for completeness (also refer to the coordinate system in the figure near the top of this paper for my definition of the x-, y- and z-axes).

    Isometric: x' = x - z and y' = y + ½ (x + z)
    Dimetric side view: x' = x + ½ z and y' = y + ¼ z
    Dimetric top view: x' = x + ¼ z and y' = y + ½ z

    Basically, you need to figure out at what height (z) you want the bullet to appear, then do the math to calc the x & y ... I suppose this means you could put a shadow at z=0 and your bullet at z=.5 (or whatever) for a nice bullet-above-the-ground effect.

    Anyhow ... how that helps.

    -Bryk
    Last edited by Brykovian; Jul 23rd, 2001 at 09:09 AM.

  3. #3
    Addicted Member
    Join Date
    Apr 2000
    Location
    England
    Posts
    246
    Depends on defination of Isometric i suppose.

    My Isometric Engine, uses a 45 Degree Angle, with a Specified Tile Height/Width

    So hieght is Specided as TileCo-ord.y + z, x remains the same.
    Some Days, i just get this feeling that i'm helping to write dozens of Viruses...

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    generic iso-projection

    a generic n-dimensioned isometric projection would be the sum of the unit vector's projections (which is a user defined vector) multiplied with the component, for each dimension. For three dimensions we have a displacement (px,py,pz) projected in D:
    D = X*px + Y*py + Z*pz

    big letters indication vectors and small letters indicating scalars.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Posting Permissions

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



Click Here to Expand Forum to Full Width