Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Dynamic Entities in Qt 3D QML
Forum Updated to NodeBB v4.3 + New Features

Dynamic Entities in Qt 3D QML

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 511 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    EStudley
    wrote on last edited by EStudley
    #1

    Hey all,

    I am trying to dynamically create lines (thin cylinders) from one point to another in a series of points in Qt 3D with QML.

    Entity objects that I create inside a Repeater, with the model of points I want to connect, do not appear.

        Scene3D {
            id: scene3D
            anchors { fill: parent }
            cameraAspectRatioMode: Scene3D.AutomaticAspectRatio
            aspects: ["input", "logic"]
            multisample: true
    
            Entity {
    
                Camera {
                    id: camera
                    projectionType: CameraLens.PerspectiveProjection
                    fieldOfView: 45
                    nearPlane : 0.1
                    farPlane : 1000.0
                    position: Qt.vector3d(0.0, 0.0, 300.0)
                    upVector: Qt.vector3d(0.0, 1.0, 0.0)
                    viewCenter: Qt.vector3d(0.0, 0.0, 0.0)
                }
    
                // DOESN'T WORK
                Repeater {
                    model: ListModel {
                        ListElement { role_start: "0, 0, 0"; role_end: "100, 100, 0" }
                        ListElement { role_start: "100, 100, 0"; role_end: "0, 200, 0" }
                    }
    
                    LineEntity {
                        start: role_start
                        end: role_end
                    }
                }
    
                // WORKS
                LineEntity {
                    start: "0, 0, 0"
                    end: "100, 100, 0"
                }
    

    Is this possible? How can I create a Qt 3D scene in QML dynamically and add/remove entities at will?

    1 Reply Last reply
    0
    • E Offline
      E Offline
      EStudley
      wrote on last edited by
      #2

      Solved! Found the NodeInstantiator class that does what Repeater does in a Scene3D.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved