- Qt 6.8
- Qt Quick 3D
- QML Types
- Object3D
- Qt Quick 3D | Commercial or GPLv3

# Object3D QML Type

Abstract base type of all 3D nodes and resources. More...

Import Statement: | `import QtQuick3D`
Inherited By: | Effect, Geometry, InstanceListEntry, InstanceModel, InstanceRange, Instancing, Material, MorphTarget, Node, Particle3D, RenderExtension, ResourceLoader, SceneEnvironment, Skin, Texture, and TextureData

- List of all members, including inherited members

## Properties

- children : list<Object3D>
- data : list<Object>
- parent : Object3D
- resources : list<Object>
- state : string
- states : list<State>
- transitions : list<Transition>

## Detailed Description

Object3D is the base class for all Qt Quick 3D types. This includes:

- Spatial types that represent objects in the 3D scene, these will normally have a position and/or a direction. For example, Model, Camera, or Light. Such types inherit from Node, which in turn inherits from Object3D.
- Resource types that do not themselves represent an object in the 3D world, but rather serve as components to Node subclasses, providing data of some kind. This includes, among others, Material, Geometry, and Texture.

In addition to the above types, Object3D can also serve as the parent for Qt Quick items, as well as arbitrary QObject instances. For more information on adding 2D items to the 3D scene, refer to Qt Quick 3D Scenes with 2D Content.

See also Node.

## Property Documentation

children : list<Object3D>
resources : list<Object>

The children property contains the list of visual children of this object. The resources property contains non-visual resources that you want to reference by name.

It is not generally necessary to refer to these properties when adding child objects or resources, as the default data property will automatically assign child objects to the `children` and `resources` properties as appropriate. See the QtQuick3D::Object3D::data documentation for details.

Note: QtQuick3D::Object3D::resources does not return a list of 3D resources despite the name. The name comes from the semantics of QQuickItem. 3D resources are subclasses of QQuickObjec3D and thus will be returned in the list of QtQuick3D::Objec3D::children.

data : list<Object> `[default]`

The data property allows you to freely mix Object3D children and resources in an object. If you assign a Object3D to the data list it becomes a child and if you assign any other object type, it is added as a resource.

So you can write:

     Object3D {
         Node {}
         DirectionalLight {}
         Timer {}
     }

instead of:

     Item {
         children: [
             Node {},
             DirectionalLight {}
         ]
         resources: [
             Timer {}
         ]
     }

It should not generally be necessary to refer to the `data` property, as it is the default property for Object3D and thus all child objects are automatically assigned to this property.

parent : Object3D

This property holds the parent of the Object3D in a 3D scene.

Note: An Object3D's parent may not necessarily be the same as its object parent. This is necessary because the object parent may be an item that is not of type Object3D, for example the root object in a scene.

state : string

This property holds the name of the current state of the object.

If the item is in its default state, that is, no explicit state has been set, then this property holds an empty string. Likewise, you can return an item to its default state by setting this property to an empty string.

See also Qt Quick States.

states : list<State>

This property holds the list of possible states for this object. To change the state of this object, set the state property to one of these states, or set the state property to an empty string to revert the object to its default state.

This property is specified as a list of State objects. For example, below is an QtQuick3D::Node with "above_state" and "below_state" states:

     import QtQuick
     import QtQuick3D

     Node {
         id: root
         y: 0

         states: [
             State {
                 name: "above_state"
                 PropertyChanges { target: root; y: 100 }
             },
             State {
                 name: "below_state"
                 PropertyChanges { target: root; y: -100 }
             }
         ]
     }

See Qt Quick States and Animation and Transitions in Qt Quick for more details on using states and transitions.

Note: This property works the same as QtQuick::Item::states but is necessary because QtQuick3D::Object3D is not a QtQuick::Item subclass.

See also QtQuick3D::Object3D::transitions.

transitions : list<Transition>

This property holds the list of transitions for this object. These define the transitions to be applied to the object whenever it changes its state.

This property is specified as a list of Transition objects. For example:

     import QtQuick
     import QtQuick3D

     Node {
         transitions: [
             Transition {
                 //...
             },
             Transition {
                 //...
             }
         ]
     }

See Qt Quick States and Animation and Transitions in Qt Quick for more details on using states and transitions.

Note: This property works the same as QtQuick::Item::transitions but is necessary because QtQuick3D::Object3D is not a QtQuick::Item subclass.

See also QtQuick3D::Object3D::states.