Unsolved How can I add a light to my Scene3D?
-
I looked in the docs for
Light
, but there are no details there. Does anyone know how I could add a light to myScene3D
and what parameters are available for it? -
Hi,
It's fromQAbstractLight
's decendatns:http://doc.qt.io/qt-5/qml-qt3d-render-directionallight.html
http://doc.qt.io/qt-5/qml-qt3d-render-pointlight.html
http://doc.qt.io/qt-5/qml-qt3d-render-spotlight.htmlMy advice is to follow the C++ docs where the class hierarchy is clearly visible. It's not straightforward with the QML docs.
-
Hi,
You can add a light with the following code (for example):Entity { id: root ... Entity { id: lightEntity components: [ DirectionalLight{ color: Qt.rgba(1, 1, 1, 1.0) intensity: 0,5 enabled: true }, Transform{ position: Qt.vector3d(5,5,5) } ] } }