Back to Filament

TransformManager

docs/android/dokka/filament-android/com.google.android.filament/-transform-manager/index.md

1.75.09.7 KB
Original Source

//filament-android/com.google.android.filament/TransformManager

TransformManager

[main]
open class TransformManager

TransformManager is used to add transform components to entities.

A transform component gives an entity a position and orientation in space in the coordinate space of its parent transform. The TransformManager takes care of computing the world-space transform of each component (i.e. its transform relative to the root).

Creation and destruction

A transform component is created using create and destroyed by calling destroy. ```kotlin Engine engine = Engine.create(); EntityManager entityManager = EntityManager().get(); int object = entityManager.create();

TransformManager tcm = engine.getTransformManager();

// create the transform component tcm.create(object);

// set its transform float[] transform = ...; // transform to set EntityInstance i = tcm.getInstance(object); tcm.setTransform(i, transform));

// destroy the transform component tcm.destroy(object);


## Functions

| Name | Summary |
|---|---|
| [commitLocalTransformTransaction](commit-local-transform-transaction.md) | [main]
open fun [commitLocalTransformTransaction](commit-local-transform-transaction.md)()
Commits the currently open local transform transaction. |
| [create](create.md) | [main]
open fun [create](create.md)(entity: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html)): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html)
Creates a transform component and associates it with the given entity.
[main]
open fun [create](create.md)(entity: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html), parent: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html), localTransform: [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-array/index.html)<[Double](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-double/index.html)>): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html)
open fun [create](create.md)(entity: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html), parent: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html), localTransform: [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-array/index.html)<[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-float/index.html)>): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html)
Creates a transform component with a parent and associates it with the given entity. |
| [destroy](destroy.md) | [main]
open fun [destroy](destroy.md)(entity: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html))
Destroys this component from the given entity, children are orphaned. |
| [getChildCount](get-child-count.md) | [main]
open fun [getChildCount](get-child-count.md)(i: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html)): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html)
Returns the number of children of an [EntityInstance](../-entity-instance/index.md). |
| [getChildren](get-children.md) | [main]
open fun [getChildren](get-children.md)(i: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html), outEntities: [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-array/index.html)<[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html)>): [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-array/index.html)<[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html)>
Gets a list of children for a transform component. |
| [getInstance](get-instance.md) | [main]
open fun [getInstance](get-instance.md)(entity: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html)): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html)
Gets an [EntityInstance](../-entity-instance/index.md) representing the transform component associated with the given [Entity](../-entity/index.md). |
| [getNativeObject](get-native-object.md) | [main]
open fun [getNativeObject](get-native-object.md)(): [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-long/index.html) |
| [getParent](get-parent.md) | [main]
open fun [getParent](get-parent.md)(i: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html)): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html)
Returns the actual parent entity of an [EntityInstance](../-entity-instance/index.md) originally defined by [setParent](set-parent.md). |
| [getTransform](get-transform.md) | [main]
open fun [getTransform](get-transform.md)(i: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html), outLocalTransform: [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-array/index.html)<[Double](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-double/index.html)>): [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-array/index.html)<[Double](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-double/index.html)>
open fun [getTransform](get-transform.md)(i: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html), outLocalTransform: [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-array/index.html)<[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-float/index.html)>): [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-array/index.html)<[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-float/index.html)>
Returns the local transform of a transform component. |
| [getWorldTransform](get-world-transform.md) | [main]
open fun [getWorldTransform](get-world-transform.md)(i: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html), outWorldTransform: [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-array/index.html)<[Double](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-double/index.html)>): [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-array/index.html)<[Double](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-double/index.html)>
open fun [getWorldTransform](get-world-transform.md)(i: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html), outWorldTransform: [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-array/index.html)<[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-float/index.html)>): [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-array/index.html)<[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-float/index.html)>
Returns the world transform of a transform component. |
| [hasComponent](has-component.md) | [main]
open fun [hasComponent](has-component.md)(entity: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html)): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-boolean/index.html)
Returns whether a particular [Entity](../-entity/index.md) is associated with a component of this `TransformManager` |
| [isAccurateTranslationsEnabled](is-accurate-translations-enabled.md) | [main]
open fun [isAccurateTranslationsEnabled](is-accurate-translations-enabled.md)(): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-boolean/index.html)
Returns whether the high precision translation mode is active. |
| [openLocalTransformTransaction](open-local-transform-transaction.md) | [main]
open fun [openLocalTransformTransaction](open-local-transform-transaction.md)()
Opens a local transform transaction. |
| [setAccurateTranslationsEnabled](set-accurate-translations-enabled.md) | [main]
open fun [setAccurateTranslationsEnabled](set-accurate-translations-enabled.md)(enable: [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-boolean/index.html))
Enables or disable the accurate translation mode. |
| [setParent](set-parent.md) | [main]
open fun [setParent](set-parent.md)(i: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html), newParent: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html))
Re-parents an entity to a new one. |
| [setTransform](set-transform.md) | [main]
open fun [setTransform](set-transform.md)(i: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html), localTransform: [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-array/index.html)<[Double](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-double/index.html)>)
open fun [setTransform](set-transform.md)(i: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html), localTransform: [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-array/index.html)<[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-float/index.html)>)
Sets a local transform of a transform component. |