MeshEntity
class MeshEntity : Entity
| kotlin.Any | |||
| ↳ | androidx.xr.scenecore.BaseScenePose | ||
| ↳ | androidx.xr.scenecore.Entity | ||
| ↳ | androidx.xr.scenecore.MeshEntity |
A renderable entity in the scene graph that renders a CustomMesh.
A MeshEntity renders a CustomMesh using a list of Materials. The number of materials must match the number of subsets in the CustomMesh.
Summary
Public companion functions |
|
|---|---|
MeshEntity |
@MainThreadCreates a new |
Public functions |
|
|---|---|
Unit |
@MainThreadSets the transforms for the bones in the skinned mesh. |
Unit |
@MainThreadSets a material for a mesh subset. |
Public properties |
|
|---|---|
@IntRange(from = 0, to = 255) Int |
The number of bones used to animate the mesh. |
List<Material> |
The list of materials used to render this entity's custom mesh. |
CustomMesh |
The |
Inherited functions |
||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||||||||||
|
Inherited properties |
||||||
|---|---|---|---|---|---|---|
|
Public companion functions
create
@MainThread
fun create(
session: Session,
mesh: CustomMesh,
materials: List<Material>,
boneCount: @IntRange(from = 0, to = 255) Int = 0,
pose: Pose = Pose.Identity,
parent: Entity? = null
): MeshEntity
Creates a new MeshEntity.
| Parameters | |
|---|---|
session: Session |
The session to use for creating the MeshEntity. |
mesh: CustomMesh |
The |
materials: List<Material> |
The list of |
boneCount: @IntRange(from = 0, to = 255) Int = 0 |
The number of bones used to animate the mesh. Must be between 0 and 255, inclusive. If 0, skinning is disabled. If non-zero, bone transforms can be set with |
pose: Pose = Pose.Identity |
The initial pose of the entity relative to its parent. Defaults to |
parent: Entity? = null |
Parent entity. Defaults to |
| Returns | |
|---|---|
MeshEntity |
A new |
| Throws | |
|---|---|
IllegalArgumentException |
if |
Public functions
setBoneTransforms
@MainThread
fun setBoneTransforms(transforms: List<Matrix4>): Unit
Sets the transforms for the bones in the skinned mesh.
This function is used to animate meshes with skeletal animations (skinning). Each bone's transform is represented by a Matrix4 object. This can only be used if boneCount is greater than zero.
| Parameters | |
|---|---|
transforms: List<Matrix4> |
A list of |
| Throws | |
|---|---|
IllegalStateException |
if |
setMaterial
@MainThread
fun setMaterial(material: Material, subsetIndex: Int = 0): Unit
Sets a material for a mesh subset.
| Parameters | |
|---|---|
material: Material |
The new |
subsetIndex: Int = 0 |
The zero-based index for the mesh subset. Default is the first subset of the mesh. |
| Throws | |
|---|---|
IllegalArgumentException |
if |
Public properties
boneCount
val boneCount: @IntRange(from = 0, to = 255) Int
The number of bones used to animate the mesh. Must be between 0 and 255, inclusive. If 0, skinning is disabled. If non-zero, bone transforms can be set with setBoneTransforms.
materials
val materials: List<Material>
The list of materials used to render this entity's custom mesh.