IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

LookAtNode QML Type

A helper node that is automatically kept pointing at another node.

This type was introduced in Qt 6.4.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

LookAtNode QML Type

  • Import Statement: import QtQuick3D.Helpers

  • Since:: Qt 6.4

  • Inherits:: Node

Detailed Description

This helper implements a node that automatically rotates so that it is always pointed towards a specified node. The rotation only happens over X and Y axes.

For example, the following snippet keeps the cylinder pointed at the cube.

 
Sélectionnez
View3D {
    anchors.fill: parent
    camera: camera

    PerspectiveCamera {
        id: camera
    }

    DirectionalLight {}

    LookAtNode {
        target: cube

        Model {
            id: cylinder
            source: "#Cone"
            eulerRotation.x: -90
            materials: [
                PrincipledMaterial {}
            ]
        }
    }

    Model {
        id: cube
        position: Qt.vector3d(300, 300, 0);
        source: "#Cube"
        materials: [ PrincipledMaterial {} ]
    }
}

Property Documentation

 

target : Node

Specifies the target node to look at. The default value is null.

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+