Node QML 类型

The base component for an object that exists in a 3D Scene. 更多...

import 语句: import QtQuick3D 1.15
继承:

Object3D

继承者:

AxisHelper , Camera , Light , Loader3D , Model ,和 Repeater3D

特性

方法

详细描述

Node type can be used to wrap other objects for the purpose of grouping them, or animating them. This snippet shows how to use Node to animate a camera.

Node {
    PerspectiveCamera {
        position: Qt.vector3d(0, 0, -600)
    }
    SequentialAnimation on eulerRotation.y {
        loops: Animation.Infinite
        PropertyAnimation {
            duration: 5000
            from: 0
            to: 360
        }
    }
}
					

Node has to be used also if creating a scene outside of View3D , for example for the purpose of switching scenes on the fly, or showing the same scene on multiple views.

Node {
    id: standAloneScene
    DirectionalLight {}
    Model {
        source: "#Sphere"
        materials: [ CopperMaterial {} ]
    }
    PerspectiveCamera {
        z: -600
    }
}
View3D {
    importScene: standAloneScene
}
					

特性文档编制

TransformSpace : enumeration

Defines the relationship of the axis.

常量 描述
Node.LocalSpace Axis is relative to the local orientation of this node.
Node.ParentSpace Axis is relative to the local orientation of the parent node.
Node.SceneSpace Axis is relative to the scene.

eulerRotation : vector3d

This property contains the rotation values for the x, y, and z axis. These values are stored as a vector3d. Rotation order is assumed to be ZXY.

另请参阅 QQuaternion::fromEulerAngles() .

forward : vector3d

This property returns a normalized vector of the nodes forward direction in scene space.

另请参阅 up , right ,和 mapDirectionToScene .

opacity : real

This property contains the local opacity value of the Node. Since Node objects are not necessarialy visible, this value might not have any affect, but this value is inherited by all children of the Node, which might be visible.

pivot : vector3d

This property contains the pivot values for the x, y, and z axis. These values are used as the pivot points when applying rotations to the node.

位置 : vector3d

This property contains the position translation in local coordinate space.

另请参阅 x , y ,和 z .

right : vector3d

This property returns a normalized vector of the nodes right direction in scene space.

另请参阅 forward , up ,和 mapDirectionToScene .

rotation : quaternion

This property contains the rotation values for the node. These values are stored as a quaternion.

scale : vector3d

This property contains the scale values for the x, y, and z axis.

scenePosition : vector3d

This property returns the position of the node in scene space.

注意: This is sometimes also referred to as the global position. But then in the meaning "global in the 3D world", and not "global to the screen or desktop" (which is usually the interpretation in other Qt APIs).

注意: the position will be reported in the same orientation as the node.

另请参阅 mapPositionToScene .

sceneRotation : quaternion

This property returns the rotation of the node in scene space.

sceneScale : vector3d

This property returns the scale of the node in scene space.

sceneTransform : matrix4x4

This property returns the global transform matrix for this node.

注意: the return value will be in right-handed coordinates.

staticFlags : int

This property defines the static flags that are used to evaluate how the node is rendered. Currently doesn't do anything but act as a placeholder for a future implementation.

该特性在 Qt 5.15 引入。

up : vector3d

This property returns a normalized vector of the nodes up direction in scene space.

另请参阅 forward , right ,和 mapDirectionToScene .

visible : bool

When this property is true, the Node (and its children) can be visible.

x : real

This property contains the x value of the position translation in local coordinate space.

另请参阅 position .

y : real

This property contains the y value of the position translation in local coordinate space.

另请参阅 position .

z : real

This property contains the z value of the position translation in local coordinate space.

另请参阅 position .

方法文档编制

vector3d mapDirectionFromNode ( QtQuick3D::Node node , vector3d localDirection )

变换 localDirection from the local space of node to the local space of this node. The return value is not affected by the (inherited) scale or position of the node.

注意: the return value will have the same length as localDirection (i.e. not normalized).

另请参阅 mapDirectionToNode , mapDirectionFromScene ,和 mapDirectionToScene .

vector3d mapDirectionFromScene ( vector3d sceneDirection )

变换 sceneDirection from scene space to local space. The return value is not affected by the (inherited) scale or position of the node.

注意: the return value will have the same length as sceneDirection (i.e not normalized).

另请参阅 mapDirectionToScene , mapDirectionToNode ,和 mapDirectionFromNode .

vector3d mapDirectionToNode ( QtQuick3D::Node node , vector3d localDirection )

变换 localDirection from this nodes local space to the local space of node . The return value is not affected by the (inherited) scale or position of the node.

注意: the return value will have the same length as localDirection (i.e. not normalized).

另请参阅 mapDirectionFromNode , mapDirectionFromScene ,和 mapDirectionToScene .

vector3d mapDirectionToScene ( vector3d localDirection )

变换 localDirection from local space to scene space. The return value is not affected by the (inherited) scale or position of the node.

注意: the return value will have the same length as localDirection (i.e. not normalized).

另请参阅 mapDirectionFromScene , mapDirectionToNode ,和 mapDirectionFromNode .

vector3d mapPositionFromNode ( QtQuick3D::Node node , vector3d localPosition )

变换 localPosition from the local space of node to the local space of this node.

另请参阅 mapPositionToScene , mapPositionFromScene ,和 mapPositionToNode .

vector3d mapPositionFromScene ( vector3d scenePosition )

变换 scenePosition from scene space to local space.

另请参阅 mapPositionToScene , mapPositionToNode ,和 mapPositionFromNode .

vector3d mapPositionToNode ( QtQuick3D::Node node , vector3d localPosition )

变换 localPosition from the local space of this node to the local space of node .

另请参阅 mapPositionToScene , mapPositionFromScene ,和 mapPositionFromNode .

vector3d mapPositionToScene ( vector3d localPosition )

变换 localPosition from local space to scene space.

注意: "Scene space" is sometimes also referred to as the "global space". But then in the meaning "global in the 3D world", and not "global to the screen or desktop" (which is usually the interpretation in other Qt APIs).

另请参阅 mapPositionFromScene , mapPositionToNode ,和 mapPositionFromNode .

rotate ( real degrees , vector3d axis , TransformSpace space )

Rotates this node around an axis 通过给定 degrees . The specified rotation will be added to the node's current rotation. The axis can be specified relative to different space s .