Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Game Development
  4. Qt3d tank example: projection of click position
QtWS25 Last Chance

Qt3d tank example: projection of click position

Scheduled Pinned Locked Moved Game Development
2 Posts 1 Posters 1.6k Views
  • 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 Offline
    A Offline
    AJOM566
    wrote on last edited by
    #1

    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
    0
    • A Offline
      A Offline
      AJOM566
      wrote on last edited by
      #2

      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
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved