Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to rotate a 3D shape?
Forum Updated to NodeBB v4.3 + New Features

How to rotate a 3D shape?

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 1.3k Views 1 Watching
  • 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.
  • Joaquin M. ParrillaJ Offline
    Joaquin M. ParrillaJ Offline
    Joaquin M. Parrilla
    wrote on last edited by
    #1

    Hello dev community!, I'm new in Qt and I'm glad to part of this community.

    I've been investigating how to rotate a basic shape from their origin axis by using the mouse drag event.

    I've been studying the Qt documentation and found for the mouse events the following methods:

    void QGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent * event)
    void QGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent * event)
    

    On the other hand, I also these methods for rotating the shapes:

    void QGraphicsItem::setTransformOriginPoint(const QPointF & origin)
    

    I've been trying to rotate a basic cuboidmesh unsuccessfully.

    Thanks and grettings!

    kshegunovK 1 Reply Last reply
    0
    • Joaquin M. ParrillaJ Joaquin M. Parrilla

      Hello dev community!, I'm new in Qt and I'm glad to part of this community.

      I've been investigating how to rotate a basic shape from their origin axis by using the mouse drag event.

      I've been studying the Qt documentation and found for the mouse events the following methods:

      void QGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent * event)
      void QGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent * event)
      

      On the other hand, I also these methods for rotating the shapes:

      void QGraphicsItem::setTransformOriginPoint(const QPointF & origin)
      

      I've been trying to rotate a basic cuboidmesh unsuccessfully.

      Thanks and grettings!

      kshegunovK Offline
      kshegunovK Offline
      kshegunov
      Moderators
      wrote on last edited by
      #2

      Hi,
      I don't follow, the graphics view framework deals with 2D images, how does a mesh factor into it?

      Read and abide by the Qt Code of Conduct

      1 Reply Last reply
      0
      • Joaquin M. ParrillaJ Offline
        Joaquin M. ParrillaJ Offline
        Joaquin M. Parrilla
        wrote on last edited by
        #3

        Hi,

        You're right kshegunov, it seems that 'QGraphicsItem' api is more focused on 2D rendering scenes.

        At the moment I used a 'QOrbitCameraController' type to get an orbital rotation from the shape around the scene:

        Qt3DExtras::QOrbitCameraController *orbitCamController = new Qt3DExtras::QOrbitCameraController(rootEntity);
        
        orbitCamController->setCamera(cameraEntity);
        

        I'll investigating to try get the right rotation.

        Greetings!

        kshegunovK 1 Reply Last reply
        0
        • Joaquin M. ParrillaJ Joaquin M. Parrilla

          Hi,

          You're right kshegunov, it seems that 'QGraphicsItem' api is more focused on 2D rendering scenes.

          At the moment I used a 'QOrbitCameraController' type to get an orbital rotation from the shape around the scene:

          Qt3DExtras::QOrbitCameraController *orbitCamController = new Qt3DExtras::QOrbitCameraController(rootEntity);
          
          orbitCamController->setCamera(cameraEntity);
          

          I'll investigating to try get the right rotation.

          Greetings!

          kshegunovK Offline
          kshegunovK Offline
          kshegunov
          Moderators
          wrote on last edited by
          #4

          @Joaquin-M.-Parrilla said in How to rotate a 3D shape?:

          more focused

          exclusively so.

          At the moment I used a 'QOrbitCameraController'

          This is a different module entirely. Take a look at Qt3DCore::QTransform for a transformation component (you attach it to your entity exactly as you do for QMesh).

          Read and abide by the Qt Code of Conduct

          1 Reply Last reply
          1
          • Joaquin M. ParrillaJ Offline
            Joaquin M. ParrillaJ Offline
            Joaquin M. Parrilla
            wrote on last edited by
            #5

            I'm going to check out right now!!

            Thanks for helping!!

            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