Navigation

    Fuze Arena Logo
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Help
    • Discord

    rotateObject() changes the coordinate system

    Advanced
    3d-maths rotation
    4
    20
    1164
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • spikey
      spikey F last edited by

      This post is deleted!
      1 Reply Last reply Reply Quote 0
      • Tratax
        Tratax F @spikey last edited by

        @spikey Awesome work! Mind sharing up the code? Curious to see how you've done this

        spikey 1 Reply Last reply Reply Quote 0
        • spikey
          spikey F @Tratax last edited by

          @Tratax Yes, its shared, you should have a friend request hanging ;-)
          Actually, its not usefull yet, because I can not find out how to handle the self-rotation axis of the red object. In my cube game, I did this with ifs: if rotx, roty, rotz = 270/180/or what ever then switch rot axis of rotateObject() to {0,1,0} or what ever. But then the complexity blew off the roof when I joined 3D objects. So, I started this test program above to get the maths right first.

          1 Reply Last reply Reply Quote 0
          • spikey
            spikey F last edited by spikey

            Isolation of the problem for the blue object (I updated the shared code as well):
            rotation_axis.jpg


            I would like to use the same axis for rotation in C as in A.

            I try now to find out how to rotate my inital axis manually so it fits the axis used by rotateObject(). the other way would be to switch the rotation axis in the parameter of rotateObject().

            I still have no clue, so if you know how to do it, I would be happy for any help.
            Probably its just a small operation, but just cant see it. Thanks.

            1 Reply Last reply Reply Quote 0
            • spikey
              spikey F last edited by

              @Tratax thanks for letting me have a look. This was smart to put the cam behind the object, because the objects-axis are always oriented like one is sitting in it. Though I can not use that principle, when having multiple objects. I give it another go. By the way, I like your well-thought-out splash screen and design from pong, as well. Nice style.

              1 Reply Last reply Reply Quote 1
              • spikey
                spikey F last edited by

                code updated:
                I could find a bug in the matrix-multiplication and found a way to revert the rotation on the blue rectangular cuboid. So, if I press j.left its left side is moving down (rotating around the old z, even after rotating it first around the y-axis.
                But if I do only a 45° rotation the y-axis it swirls around its length axis. (?) Anyone knows somebody working with robotics?

                1 Reply Last reply Reply Quote 0
                • spikey
                  spikey F last edited by

                  I almost gave up. So, I would like to share that, to shorten your path, if you decide to do some 3D. I found out that there is a local coordinate system and global coordinate system if you program a 3D scene. (If you knew it, don't tell me now ;-))
                  If you want to rotate multiple objects you have to track the rotation changes for every object to be able to call the rotateObject() for each object with the appropriate axis.

                  It would be very helpful to have a rotateObjectGlobal() function that rotates all objects according to the global coordinate system.

                  Dave 1 Reply Last reply Reply Quote 2
                  • Dave
                    Dave Fuze Team @spikey last edited by

                    @spikey This is a truly impressive series of posts, we commend you massively for this, showing your working out - it's awesome to see.

                    You're going to love (or maybe hate!) a few new functions coming in the next patch ;)

                    1 Reply Last reply Reply Quote 0
                    • spikey
                      spikey F last edited by

                      Thank you :) I am glad if this is interesting for others as well. Hey, I can imagine what you mean, haha, but the patch I am gonna love any way.

                      1 Reply Last reply Reply Quote 0
                      • spikey
                        spikey F last edited by spikey

                        To be able to re-use the code I put it into a rotateCustomObject(customObjectHandle, axis, angle) function. And shared it (SW-4464-9632-0709), if you are interested.
                        Maybe I will have to update it, because the movement was not tested yet, and I think also of being able to set a rotation origin :---)
                        If you find bugs, thanks for the feedback - if you have a suggested fix, go ahead, thanks.

                        rotateCustomObjectCode.jpg

                        rotateCustomObject_screen.jpg

                        1 Reply Last reply Reply Quote 1
                        • First post
                          Last post