3 Replies Latest reply on Feb 19, 2008 1:13 AM by Newsgroup_User

    getting a model's y coordiante

    midget35
      Pretty basic stuff - I know in flash it's just 'thisMovieClip.y', but I can't for the life of me get it to work with Lingo. I'm trying to do something like:

      if gameWorld.model("car").position.y < 20 then
      -- do stuff

      ... but no joy. Can anyone help?

      Many thanks
        • 1. Re: getting a model's y coordiante
          Level 7
          You can't really compare the 2-d positioning of Flash with a model's
          location in 3d space, but if you want to know where in 3d space a model
          is, you can use it's worldPosition

          put member("3dmember").model("car").worldPosition
          -- vector( 1,0,2)

          In which case the 1st number is the X axis, the 2nd number is the Y
          axis, and the 3rd number is (you guessed it) the Z axis.
          • 2. Re: getting a model's y coordiante
            midget35 Level 1
            Thank you for helping me out again Mike.

            With the attached suggestion:

            put member("3dmember").model("car").worldPosition
            -- vector( 1,0,2)

            How can I then ask for only the y value to be returned as an integer? Sorry if I'm missing the point - I truly appreciate your expertise
            • 3. Re: getting a model's y coordiante
              Level 7
              midget35 wrote:
              > put member("3dmember").model("car").worldPosition
              > -- vector( 1,0,2)
              >
              > How can I then ask for only the y value to be returned as an integer?
              > Sorry if I'm missing the point - I truly appreciate your expertise

              A vector has x, y and z properties, so you want
              member("3dmember").model("car").worldPosition.y

              Vectors are made with "floats"; to get an integer you can use bitor:-

              a=vector(1,2,3)
              put a
              -- vector( 1.0000, 2.0000, 3.0000 )
              put a.y
              -- 2.0000
              put bitor(a.y, 0)
              -- 2

              (You can also address the components of a vector as if it were a list, like
              a[2] for y.)

              Andrew