Node QML Type▲
-
Import Statement: import QtQuick3D
-
Inherited By:: Affector3D, AxisHelper, Camera, CollisionNode, CollisionShape, Joint, Light, Loader3D, LookAtNode, Model, ParticleEmitter3D, ParticleSystem3D, ReflectionProbe, Repeater3D, RuntimeLoader, and Skeleton
-
Inherits:: Object3D
Detailed Description▲
The Node type serves as the base class for other spatial types, such as, Model, Camera, Light. These objects represent an entity that exists in the 3D scene, due to having a position and other properties in the 3D world. With the exception of the root node(s), all Node types are transformed relative to their parent Node, that is, in local coordinates. In many ways the Node type serves the same purpose in Qt Quick 3D scenes as Item does for Qt Quick scenes.
In addition to types deriving from Node, it is also possible to parent other types to a Node. This includes QObject instances, where the Node merely serves as the QObject parent, and Qt Quick items.
Wrapping other objects for the purpose of grouping them into components or sub-trees can be a convenient way to, for example, animated a group of nodes as a whole. 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
:
[ DefaultMaterial {}
]
}
PerspectiveCamera {
z
:
600
}
}
View3D {
importScene
:
standAloneScene
}
Property Documentation▲
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.
See Also▲
See also QQuaternion::fromEulerAngles()
[read-only] forward : vector3d▲
This property returns a normalized vector of the nodes forward direction in scene space.
See Also▲
See also up, right, mapDirectionToScene
opacity : real▲
This property contains the local opacity value of the Node. Since Node objects are not necessarily visible, this value might not have any effect, 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.
position : vector3d▲
This property contains the position translation in local coordinate space.
See Also▲
[read-only] right : vector3d▲
This property returns a normalized vector of the nodes right direction in scene space.
See Also▲
See also 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.
[read-only] 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.
See Also▲
See also mapPositionToScene
[read-only] sceneRotation : quaternion▲
This property returns the rotation of the node in scene space.
[read-only] sceneScale : vector3d▲
This property returns the scale of the node in scene space.
[read-only] sceneTransform : matrix4x4▲
This property returns the global transform matrix for this node.
the return value will be in right-handed coordinates.
[since 5.15] 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.
This property was introduced in Qt 5.15.
[read-only] up : vector3d▲
This property returns a normalized vector of the nodes up direction in scene space.
See Also▲
See also 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.
See Also▲
See also position
y : real▲
This property contains the y value of the position translation in local coordinate space.
See Also▲
See also position
z : real▲
Method Documentation▲
vector3d mapDirectionFromNode(QtQuick3D::Node 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.
the return value will have the same length as localDirection (i.e. not normalized).
If node is null, then localDirection is interpreted as it is in scene space coordinates.
See Also▲
vector3d mapDirectionFromScene(vector3d sceneDirection)▲
Transforms 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).
See Also▲
vector3d mapDirectionToNode(QtQuick3D::Node 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.
the return value will have the same length as localDirection (i.e. not normalized).
if node is null, then the returned direction will be transformed into scene space coordinates.
See Also▲
vector3d mapDirectionToScene(vector3d localDirection)▲
Transforms 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).
See Also▲
vector3d mapPositionFromNode(QtQuick3D::Node node, vector3d localPosition)▲
Transforms localPosition from the local space of node to the local space of this node.
If node is null, then localPosition is interpreted as it is in scene space coordinates.
See Also▲
vector3d mapPositionFromScene(vector3d scenePosition)▲
Transforms scenePosition from scene space to local space.
See Also▲
vector3d mapPositionToNode(QtQuick3D::Node node, vector3d localPosition)▲
Transforms localPosition from the local space of this node to the local space of node.
If node is null, then localPosition will be transformed into scene space coordinates.
See Also▲
vector3d mapPositionToScene(vector3d localPosition)▲
Transforms 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).
See Also▲
rotate(real degrees, vector3d axis, enumeration 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.
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. |