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!