Kuesa Transform Trackers

Kuesa 3D allows designers and developers to work together on a complex 3D scene, while keeping control of their disciplines throughout the workflow. It makes the collaboration of designers and developers much more manageable by offering a seamless, integrated workflow. Designers can realize their vision using their favorite tools, developers can focus on their strengths without having to deal with design issues, and management can rely on getting better products to market faster. This blog post explores transform trackers from the perspective of a developer in an existing 3D scene.

Transform Trackers

When you have a scene with multiple entities, you might want to label an entity or track the entity as it moves. Using a transform tracker allows you to follow the screen position of an entity as it moves within the scene, so that you can then bind other elements to this position.

The first step is to add a TransformTracker to your View3D‘s transformTrackers. You indicate which Entity you want to track by passing its name as seen in the following example:

KuesaUtils.View3D {
    id: scene3D
    ...
    transformTrackers: [
        Kuesa.TransformTracker {
            id: tracker1
            name: pickedEntity.objectName
        }
    ]
    ...
}

Text tracking

Now, if you add a QML Text element, you can use screenPosition from the TransformTracker to follow the Entity’s position:

Text {
    readonly property point position: tracker1.screenPosition

    text: qsTr("Picked Entity")
    x: position.x - (implicitWidth * 0.5)
    y: position.y - implicitHeight
}

Example

The gif below shows how the example code from the Kuesa repository looks when it’s running. You’ll notice that each cube has a label tracking its location as they are animated.

transform trackers

The example code for this gif can be found at https://github.com/KDAB/kuesa/tree/master/blog/tracking.

Leave a Reply

Your email address will not be published. Required fields are marked *