6 Replies Latest reply on May 22, 2007 6:46 AM by biiin

    store original worldtransform

    biiin
      Hi there! Having problem with a reset world function. I would like to set the model to its orginal position, in tilt to. i figured thise out : member("world").model("3dobject").getWorldTransform() how should i store this in a variable so i can call it later on when i want to reset the world?

      Kind regards.
        • 1. store original worldtransform
          danieloizo
          hi

          global object_WT

          on beginsprite --or something
          .
          .
          .
          object_WT = member("world").model("3dobject").getWorldTransform()
          --stores the world transform (POSITION ,ROTATION,SCALE)
          end

          on restoretheposition
          member("world").model("3dobject").transform = object_WT
          end

          Daniel.
          • 2. Re: store original worldtransform
            biiin Level 1
            tryed the code, but i get :
            Variable used before assignd value : member("world").model("3dobject").transform = object_WT?

            any ideas?
            • 3. Re: store original worldtransform
              danieloizo Level 1
              Is The variable("object_WT") global?
              have you used
              "object_WT = member("world").model("3dobject").getWorldTransform() " before
              "member("world").model("3dobject").transform = object_WT" ?

              Maybe you show us some of your code... would be easier to help you, or explain more detailed on how you want to use it. i gave you an example on how it should work, maybe in your case you have to implement it in an other way.
              • 4. Re: store original worldtransform
                biiin Level 1
                (on the first frame)
                on exitFrame me
                object_WT = member("test").model("svart").getWorldTransform()
                end

                and then to reset :
                on mouseUp
                member("world").model("3dobject").transform = object_WT
                end

                Thank you for taking your time to teach me =)
                • 5. Re: store original worldtransform
                  danieloizo Level 1
                  there should be :
                  on mouseUp
                  member("test").model("svart").transform = object_WT
                  end

                  and before the "on exitFrame" place "global object_WT"
                  and before "on mouseUp" place "global object_WT"

                  global object_WT
                  on exitFrame me
                  object_WT = member("test").model("svart").getWorldTransform()
                  end

                  global object_WT
                  on mouseUp
                  member("test").model("svart").transform = object_WT
                  end

                  I'm glad if I can help :)
                  • 6. Re: store original worldtransform
                    biiin Level 1
                    You realy did save my day...and a*.
                    Thank you so very much!