Navigation

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

    Camera rotates if pointing bottom-up instead of tilting

    Beginners
    camera 3d-game
    4
    11
    706
    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

      To use the nice 3D background with the heaven and the clouds (setEnvironment(2, ...)) I put the camera position bottom-up (in this direction, there are less clouds). CamPosition.jpg
      To make the 3D title view looking nicer, I wanted to move the camera view direction a bit to the right or left. Instead of just changing the view on the 3D letters, the camera starts rotating.
      In the second part of the video you see how the letters change, if I increase X:

      I expected the letters just to tilt a bit, not to flip 90 degrees. Any idea why the camera view is doing this?

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

        I think your experiencing gimbal lock. It happens when your looking straight up. It's caused by being too close to 0 on two axis. Probably fix by moving your model away from one of the axis. Google gimbal lock for more.

        spikey 2 Replies Last reply Reply Quote 2
        • PickleCatStars
          PickleCatStars F last edited by

          The camera flips over while going from in front of an object to behind it. It’s to keep the camera upright with regards to game space. Putting the camera pointing straight up probably puts it exactly half way through a flip. 90 degrees..

          1 Reply Last reply Reply Quote 2
          • spikey
            spikey F @xevdev last edited by

            Thanks, for your ideas.
            @xevdev This is probably what happens, if I set z from -0.01 for the direction to 0. Then the background and the model disappears. Just a blackscreen is seen.
            @toxibunny I feel like this seems to be the reason. Then I will need to workaround, by not using the background or the built in camera.

            waldron 1 Reply Last reply Reply Quote 1
            • spikey
              spikey F @xevdev last edited by spikey

              @xevdev It is definitively the gimbal lock. The predfined rotation-order is defining the plane x-z as the ground. I found a good video about that

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

                @spikey couldn't you clamp a point so it wouldn't reach that point

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

                  @waldron yeah, I was thinking too about just avoiding the point where z and x is zero. But beside the effect that the whole scene disappears at that point, the camera path is making a curve combined with a rotation, when I only get close to that point.

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

                    But basically, nobody will probably ever place the camera like this. Its a selfmade problem, so I just hope this thread saves others some time. For me it was good to hear some thoughts about it. Maybe the setenvironment command could be used more often, when the image could be positioned.

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

                      There are requests to be able to tilt the camera, so maybe this will be a non-issue sometime soon. It is quite an edge use case you’ve found though :P

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

                        You'll see this if you try a flight sim and it's annoying. I think think the only way around it is by using quaternions and vector math. And that's a lot of maths to chug through every frame.

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

                          how about a box that moves in as fake sky or clouds as you reach that point i know its masking the problem but possible work around.

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