Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Setting SphereGeometry pickable leads to QML crashing in QTquick3D
Forum Updated to NodeBB v4.3 + New Features

Setting SphereGeometry pickable leads to QML crashing in QTquick3D

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 225 Views 2 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.
  • V Offline
    V Offline
    Vinny
    wrote last edited by Vinny
    #1

    Hi, I am pretty new to QML development so bear with me.

    Versions:
    Python 3.13.5
    Pyside 6.9.1
    QtQuick3D

    Installed with pip

    Platform: Windows11

    Running the main Python program from terminal, but got the same issue running in QT creator 16.02.

    I am trying to implement a pickable sphere into my application (for changing camera focus between objects on klick).
    But I have so far run into a couple of problems working with spheres.

    First I tried using the built in #Sphere source:

    Model {
        
        id: test_sphere
        pickable: true
        property real a: 6378.137
        property real b: 6356.752314245
        
        source: "#Sphere"
        position: Qt.vector3d(0, 0, -13000)
        
        scale: Qt.vector3d(100, 100, 100)
        materials: PrincipledMaterial {
            
            metalness: 0
            roughness: 1    
            specularAmount: 0
            emissiveFactor: Qt.vector3d(1, 1, 1)
        }
    }
    

    This model loads and picking works as excpected. The problem is that I couldn't find how the scaling factor works. Idealy I would like to set the radius/diameter of the sphere directly which would make the scaling easy.

    In the example using scale:

    Qt.vector3d(100, 100, 100)
    

    seems to just scale the sphere to an arbetrary size and I can't see how the numbers correspond to the envirenoment coordinates. I was not able to find any documentation on this either.

    So searching for alternatives I found that I could define the sphere with geometry:

     geometry: SphereGeometry { radius: 1.0 }
    

    This made scaling the sphere easy to work with, but when I set pickable to true, the program crashes when trying to load the sphere with error:

    Windows fatal exception: access violation
    

    So seems that there is something deeper in the QML/C++ not working.
    Code:

    Model {
        
        id: test_sphere
        pickable: true
    
        position: Qt.vector3d(0, 0, -13000)
        geometry: SphereGeometry { radius: 1.0 }
        scale: Qt.vector3d(100, 100, 100)
    
        materials: PrincipledMaterial {
            metalness: 0
            roughness: 1    
            specularAmount: 0
            emissiveFactor: Qt.vector3d(1, 1, 1)
        }
    }
    

    Is this a bug or is pickable simply not compatible when using geometry?

    Alternatively if someone could explane to me the scaling factor of the built in #Sphere that would be great!

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Jonas Karlsson
      wrote last edited by
      #2

      This sounds like a bug and I think you should report it to https://bugreports.qt.io/

      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