Node QML Type | Qt Quick 3D 5.14.1

Qt 5.14 | Qt Quick 3D | QML Types | Node QML Type

Qt 5.14.1 Reference Documentation

# Node QML Type

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

Import Statement: | import QtQuick3D 1.0
Inherits: | Object3D
Inherited By: | AxisHelper, Camera, Light, Loader3D, Model, and Repeater3D

- List of all members, including inherited members

## Properties

- TransformSpace : enumeration
- forward : vector3d
- opacity : real
- orientation : enumeration
- pivot : vector3d
- position : vector3d
- right : vector3d
- rotation : vector3d
- rotationOrder : enumeration
- scale : vector3d
- scenePosition : vector3d
- sceneRotation : vector3d
- sceneScale : vector3d
- sceneTransform : matrix4x4
- up : vector3d
- visible : bool
- x : real
- y : real
- z : real

## Methods

- vector3d mapDirectionFromNode(node, vector3d localDirection)
- vector3d mapDirectionFromScene(sceneDirection)
- vector3d mapDirectionToNode(node, vector3d localDirection)
- vector3d mapDirectionToScene(localDirection)
- vector3d mapPositionFromNode(node, vector3d localPosition)
- vector3d mapPositionFromScene(scenePosition)
- vector3d mapPositionToNode(node, vector3d localPosition)
- vector3d mapPositionToScene(localPosition)
- rotate(degrees, vector3d axis, TransformSpace space)

## Detailed Description

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 rotation {
              loops: Animation.Infinite
              PropertyAnimation {
                  duration: 5000
                  to: Qt.vector3d(0, 360, 0)
                  from: Qt.vector3d(0, 0, 0)
              }
          }
      }

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
      }

## Property Documentation

TransformSpace : enumeration

Defines the relationship of the axis.

Constant | Description
--- | ---
`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.

forward : vector3d

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

See also up, right, and 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.

orientation : enumeration

This property defines whether the Node is using a right-handed or left-handed coordinate system.

Constant | Description
--- | ---
`Node.LeftHanded` | Left-handed coordinate system.
`Node.RightHanded` | Right-handed coordinate system.

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.

position : vector3d

This property contains the position translation in local coordinate space.

See also x, y, and z.

right : vector3d

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

See also forward, up, and mapDirectionToScene.

rotation : vector3d

This property contains the rotation values for the x, y, and z axis. These values are stored as euler angles.

rotationOrder : enumeration

This property defines in what order the rotation properties components are applied in.

Constant | Description
--- | ---
`Node.XYZ` | Left-handed XYZ rotation order.
`Node.YZX` | Left-handed YZX rotation order.
`Node.ZXY` | Left-handed ZXY rotation order.
`Node.XZY` | Left-handed XZY rotation order.
`Node.YXZ` | Left-handed YXZ rotation order.
`Node.ZYX` | Left-handed ZYX rotation order.
`Node.XYZr` | Right-handed XYZ rotation order.
`Node.YZXr` | Right-handed YZX rotation order.
`Node.ZXYr` | Right-handed ZXY rotation order.
`Node.XZYr` | Right-handed XZY rotation order.
`Node.YXZr` | Right-handed YXZ rotation order.
`Node.ZYXr` | Right-handed ZYX rotation order.

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.

Note: 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).

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

See also mapPositionToScene.

sceneRotation : vector3d

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.

Note: the return value will be `LeftHanded` or `RightHanded` depending on orientation.

up : vector3d

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

See also forward, right, and 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.

See also position.

y : real

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

See also position.

z : real

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

See also position.

## Method Documentation

vector3d mapDirectionFromNode(node, vector3d localDirection)

Transforms 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.

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

See also mapDirectionToNode, mapDirectionFromScene, and mapDirectionToScene.

vector3d mapDirectionFromScene(sceneDirection)

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

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

See also mapDirectionToScene, mapDirectionToNode, and mapDirectionFromNode.

vector3d mapDirectionToNode(node, vector3d localDirection)

Transforms 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.

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

See also mapDirectionFromNode, mapDirectionFromScene, and mapDirectionToScene.

vector3d mapDirectionToScene(localDirection)

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

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

See also mapDirectionFromScene, mapDirectionToNode, and mapDirectionFromNode.

vector3d mapPositionFromNode(node, vector3d localPosition)

Transforms localPosition from the local space of node to the local space of this node.

See also mapPositionToScene, mapPositionFromScene, and mapPositionToNode.

vector3d mapPositionFromScene(scenePosition)

Transforms scenePosition from scene space to local space.

See also mapPositionToScene, mapPositionToNode, and mapPositionFromNode.

vector3d mapPositionToNode(node, vector3d localPosition)

Transforms localPosition from the local space of this node to the local space of node.

See also mapPositionToScene, mapPositionFromScene, and mapPositionFromNode.

vector3d mapPositionToScene(localPosition)

Transforms localPosition from local space to scene space.

Note: "Scene space" is sometimes also reffered 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).

See also mapPositionFromScene, mapPositionToNode, and mapPositionFromNode.

rotate(degrees, vector3d axis, TransformSpace space)

Rotates this node around an axis by the given degrees. The specified rotation will be added to the node's current rotation. The axis can be specified relative to different spaces.