My Qt widget show the 3D world.
I have the 3D world's Qt3DRender::QCamera
How can I use Qcamera to convert the mouse position in widget to 3D world coordinate?
I tried to use point * .viewMatrix4x4().transposed().inverted() but it is wrong.
You cannot simply convert a 2D click to a 3D coordinate, only to a 3D vector which is a direction vector. You can only obtain a 3D coordinate if you have an object which is underneath the mouse.
In this case, you can use QObjectPicker
to obtain the coordinate.
The steps to do so are:
You can also check out the manual Qt3D test on GitHub. It's in QML but you should be able to translate it to C++ (if that's what you're programming in).