import QtQuick 2.0 import Qt3D 2.0 import Qt3D.Render 2.0 import QtQuick.Scene3D 2.0 ApplicationWindow { id: window // the SphereEntity.x position has a binding to this property property real inputX Scene3D { id: scene3D anchors.fill: parent focus: true aspects: "input" Keys.onPressed: { console.debug("key pressed:", event.key) if (event.key === Qt.Key_S) { window.inputX += 10 } else if (event.key === Qt.Key_D) { window.inputX -= 10 } else if (event.key === Qt.Key_C) { entityLoader.source = "SphereEntity.qml" } else if (event.key === Qt.Key_B) { entityLoader.source = "" } } Entity { Camera { id: camera projectionType: CameraLens.PerspectiveProjection fieldOfView: 45 aspectRatio: window.width / window.height nearPlane : 0.1 farPlane : 1000.0 position: Qt.vector3d( 0.0, 0.0, -100.0 ) upVector: Qt.vector3d( 0.0, 1.0, 0.0 ) viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 ) } Configuration { controlledCamera: camera } components: [ FrameGraph { activeFrameGraph: Viewport { id: viewport rect: Qt.rect(0.0, 0.0, 1.0, 1.0) // From Top Left clearColor: "lightblue" CameraSelector { id : cameraSelector camera: camera ClearBuffer { buffers : ClearBuffer.ColorDepthBuffer } } } } ] SphereEntity {y: -40 } // if added statically, wrapping inside an Entity works.. but if created dynamically with an EntityLoader, it does not work! // Entity { // SphereEntity { y: 20 } // } EntityLoader { id: entityLoader // NOTE: the torus created here initially is correctly applied its transform // further ones created dynamically do not have the correct transform applied! source: "SphereEntity.qml" }// EntityLoader }//sceneRootEntity } }