In the following code, mapTo3DScene() will fail with the error:
QML View3D: Cannot resolve scene position without a camera assigned!
qml: pos3D: QVector3D(0, 0, 0)
Note that explicit setting the camera in View3D like this:
will make mapTo3DScene() work properly, but then View3D content will fail to be displayed.
I notice that adding view.update() to onMouseXChanged will make View3D content to be display, but this is ugly since it will only show content on mouse move. I tried calling view.update() on Component.complet but this fails.
The attached example shows a red Sphere Model, be sure to compile commenting / uncommentig line 27 in main.qml, where the OrtographicCamera is explicitly set.
- camera explicit set: mapTo3DScene() works but View3D content display fails
- camera not explicit set: mapTo3DScene() fails, but View3D content display works