2 Replies Latest reply on Aug 14, 2006 8:43 AM by Jez Cheesman

    Moving a texture layer around a plane

    Jez Cheesman
      Hi

      I've got 2 textures on a plane,
      1) the base texture repeated all over the plane,
      2) a bitmap with a circular alpha channel

      i want to be able to move the circle around the plane:

      so this all works fine generating the circle:

      member("Scene2").shader("planeShader").TEXTURELIST[2] = MEMBER("SCENE2").texture("Circle1Texture")
      member("Scene2").shader("planeShader").blendFunctionList[2] = #blend
      member("Scene2").shader("planeShader").blendSourceList[2] = #alpha
      member("Scene2").shader("planeShader").textureRepeatlIST[2] = FALSE
      member("Scene2").shader("planeShader").textureTransformList[2].scale = vector(0.6, 0.6, 1)
      member("Scene2").shader("planeShader").TextureTransformList[2].position = vector( 0.00, 0.00, 0.00 )

      but when i try to move it using the same line with any numbers in it
      member("Scene2").shader("planeShader").TextureTransformList[2].position = vector( 50.00, 50.00, 0.00 )

      the circle just disappears off the whole plane?

      The plane is 2000x2000 so a movement of 50 shouldn't move it off the plane. (I've tried a whole range of numbers from 1 to 1000)

      any ideas anyone? - can anyone see why this isn't working?

      cheers
      Jez.




        • 1. Moving a texture layer around a plane
          Necromanthus Level 2
          quote:

          Originally posted by: Jez C
          but when i try to move it using the same line with any numbers in it
          member("Scene2").shader("planeShader").TextureTransformList[2].position = vector( 50.00, 50.00, 0.00 )
          the circle just disappears off the whole plane?
          The plane is 2000x2000 so a movement of 50 shouldn't move it off the plane. (I've tried a whole range of numbers from 1 to 1000)


          The translation vector has to be between vector(-1,-1,0) and vector(1,1,0).
          So ... in your case:
          member("Scene2").shader("planeShader").TextureTransformList[2].position = vector( 50.0000/2000, 50.0000/2000, 0 )
          That's all.

          • 2. Re: Moving a texture layer around a plane
            Jez Cheesman Level 1
            many thanks necromanthus,

            that sorted it.