public class SpatialGltfModelState(internal val source: SpatialGltfModelSource) : AutoCloseable
A state object that can be hoisted to observe and control a SpatialGltfModel.
A SpatialGltfModelState can be used to query loading and animation status, and to start or stop animations on the associated SpatialGltfModel.
To create and remember a SpatialGltfModelState, use rememberSpatialGltfModelState. If a SpatialGltfModelState instance is manually created using the constructor then the caller needs to call close to free its resources when it is no longer needed.
Parameters
| source | The SpatialGltfModelSource that defines where to load the 3D model from. |
Properties
status
public val status: SpatialGltfModelStatus
The current SpatialGltfModelStatus of the glTF model.
It will initially be SpatialGltfModelStatus.Loading until the model is loaded and ready to be displayed at which point it should be SpatialGltfModelStatus.Loaded. However, if the model fails to load for any reason, the status will be a SpatialGltfModelStatus.Failed with the exception that was thrown.
nodes
public val nodes: List<GltfModelNode>
The subnodes defined in the glTF model.
These nodes allow access and manipulation of the pose and scale of the node which could be useful for manipulating the glTF model or positioning content relative to a particular node in the glTF model.
animations
public val animations: List<SpatialGltfModelAnimation>
The animations defined in the glTF model.
Each animation can be controlled individually and multiple animations may be playing at one time as long as those animations affect different parts of the model.