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. Is this solved? I cannot make triangle picking work.
Forum Updated to NodeBB v4.3 + New Features

Is this solved? I cannot make triangle picking work.

Scheduled Pinned Locked Moved Unsolved Game Development
6 Posts 3 Posters 887 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.
  • H Offline
    H Offline
    huajian
    wrote on last edited by
    #1

    Re: Qt3D point and line picking?

    I am using Qt5.15.0. But this code cannot even compile because I cannot add a QSphereGeometry as component into entity. This line is reported error.

    auto sphere = new Qt3DExtras::QSphereGeometry;
    entity->addComponent(sphere)
    
    jsulmJ JonBJ 2 Replies Last reply
    0
    • H huajian

      Re: Qt3D point and line picking?

      I am using Qt5.15.0. But this code cannot even compile because I cannot add a QSphereGeometry as component into entity. This line is reported error.

      auto sphere = new Qt3DExtras::QSphereGeometry;
      entity->addComponent(sphere)
      
      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @huajian said in Is this solved? I cannot make triangle picking work.:

      This line is reported error

      Can you post the error?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      H 1 Reply Last reply
      2
      • H huajian

        Re: Qt3D point and line picking?

        I am using Qt5.15.0. But this code cannot even compile because I cannot add a QSphereGeometry as component into entity. This line is reported error.

        auto sphere = new Qt3DExtras::QSphereGeometry;
        entity->addComponent(sphere)
        
        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by
        #3

        @huajian
        I know nothing about this/what the correct solution to your issue is, but addComponent() requires a QComponent, and while both that and QSphereGeometry inherit from QNode, a QGeometry is not a QComponent.

        H 1 Reply Last reply
        3
        • jsulmJ jsulm

          @huajian said in Is this solved? I cannot make triangle picking work.:

          This line is reported error

          Can you post the error?

          H Offline
          H Offline
          huajian
          wrote on last edited by
          #4

          @jsulm

          ../basicshapes-cpp/scenemodifier.cpp:159:26: error: cannot initialize a parameter of type 'Qt3DCore::QComponent *' with an lvalue of type 'Qt3DExtras::QSphereGeometry *'
              entity->addComponent(sphere);
                                   ^~~~~~
          

          I know it should not work. But the author of the post that I cited reported his code worked! This is unexpected for me.

          1 Reply Last reply
          0
          • JonBJ JonB

            @huajian
            I know nothing about this/what the correct solution to your issue is, but addComponent() requires a QComponent, and while both that and QSphereGeometry inherit from QNode, a QGeometry is not a QComponent.

            H Offline
            H Offline
            huajian
            wrote on last edited by
            #5

            @JonB
            Thanks. I also expect so. The strange thing is that someone(see: Re: Qt3D point and line picking?) report his code(as I post here) worked!

            JonBJ 1 Reply Last reply
            0
            • H huajian

              @JonB
              Thanks. I also expect so. The strange thing is that someone(see: Re: Qt3D point and line picking?) report his code(as I post here) worked!

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #6

              @huajian
              I did see it used in the link you mentioned. I'm afraid you cannot rely on everything posted in this forum being literally correct! :) It may have worked then, or it may never have worked. I don't know your area, but I would read up about nodes, components & geometries until I knew how they fitted together --- which you will need to understand anyway --- and then hopefully I'd know the answer!

              1 Reply Last reply
              1

              • Login

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