3 Replies Latest reply on Apr 12, 2007 8:20 AM by Nickname_is_none

    image 3d movement

    Nickname_is_none
      I have some images following each other around in a circular motion. I want to add a Z dimension so that the images now follow each other in an eliptical motion, but the images get smaller as they move into the distance. How can I do this? Here is part of my current code for the movement:

      if gRotateR then
      currentangle = currentangle + 2
      sprite(me.spriteNum).locH = (sin((currentangle + pOffset)/57.296) * circleradius) + circlecenter.locH
      sprite(me.spriteNum).locV = (cos((currentangle + pOffset)/57.296) * circleradius) + circlecenter.locV
      end if
        • 1. Re: image 3d movement
          duckets Level 1
          First, store sprite(me.spritenum) in a property and use that property instead, so you don't have to keep writing that out:

          my = sprite(me.spritenum)

          Then add: * 0.5 after circleradius for the locV line, to change from a circle to an elipse:

          my.locV = (cos((currentangle + pOffset)/57.296) * circleradius * 0.5) + circlecenter.locV

          Also, adjust the sprite's width and height based on a similar equation to the one you use for your locV:

          my.locZ = my.locV
          zScale = 1/((-cos((currentangle + pOffset)/57.296) * 0.3)+1)
          my.width = my.member.width * zScale
          my.height = my.member.height * zScale

          And finally you'll probably want to z-sort your sprites based on their locv:

          my.locZ = my.locV

          Hope this helps!

          - Ben
          • 2. Re: image 3d movement
            Level 7
            Nickname is none wrote:
            > I have some images following each other around in a circular motion.
            > I want to add a Z dimension so that the images now follow each other
            > in an eliptical motion, but the images get smaller as they move into
            > the distance. How can I do this?

            Are you asking how to make them stay the same size on screen?

            refToYour3dModel.camera[1].projection=#orthographic

            Andrew


            • 3. Re: image 3d movement
              Nickname_is_none Level 1
              Thanks Andrew, but I want them to get smaller as they move into the distance (then get bigger when they return to the foreground).

              Duckets, that's worked perfectly. The only issue I have now is that I had them dissapearing behind an image when they move into the background, but they are now rotating on totally on top of this image. How can I fix this?