Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Call for Presentations - Qt World Summit

    Qt3d tank example: projection of click position

    Game Development
    1
    2
    1410
    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.
    • A
      AJOM566 last edited by

      Hi,
      I played around with the qt3d tank example and found that when creating new tanks, they are not exactly placed at the position I double clicked. This is only true for the middle of the plane but not for the edges. At the edges there is a shift which depends on the distance to the middle of the plane. I could not find any obvious errors when looking at the code.

      Any ideas?

      link to tank example:
      http://qt.gitorious.org/qt/qt3d/trees/1ce13f86c7066721ce80258d6a89baccc4030066/examples/qt3d/tank

      1 Reply Last reply Reply Quote 0
      • A
        AJOM566 last edited by

        I've found the error.
        The camera's upVector has not been updated (default: 0,1,0). When the camera's direction (eye-center) is not parallel to the plane (as it is in the example), then the initial upVector is no longer orthogonal to the camera direction. For a correct projection, however, it must be. So you have to calculate a new upVector in initializeGL, after having positioned the eye.

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