API reference
API reference
Select your platform
No SDKs available
No versions available

AnchorMeshSpawner

AnchorMeshSpawner

class AnchorMeshSpawner(val mrukFeature: MRUKFeature, var spawnGroups: Map<MRUKLabel, AnchorMeshSpawner.AnchorMeshGroup>, val spawnMode: MRUKSpawnMode = MRUKSpawnMode.CURRENT_ROOM_ONLY)
The AnchorMeshSpawner class is designed to facilitate the spawning of 3D meshes (glb/gltf) at scene anchor locations. It is intended for use in conjunction with the MRUKFeature. This class automatically spawns meshes in a room when new anchors are loaded by the MRUKFeature, ensuring that the meshes remain synchronized with the current anchors. The spawning behavior can be customized using the spawnMode. For usage examples, refer to the MrukSampleActivity. Note that if you want to generate walls and floors without providing meshes for it refer to the AnchorProceduralMesh. The spawnGroups parameter specifies which meshes to spawn based on a label. It is crucial to invoke the destroy() method when the AnchorMeshSpawner instance is no longer in use.

Constructors

NameSummary
AnchorMeshSpawner
constructor(mrukFeature: MRUKFeature, spawnGroups: Map<MRUKLabel, AnchorMeshSpawner.AnchorMeshGroup>, spawnMode: MRUKSpawnMode = MRUKSpawnMode.CURRENT_ROOM_ONLY)

Types

NameSummary
data class AnchorMeshGroup(val meshes: List<String>, val selectionMode: AnchorMeshSelectionMode = AnchorMeshSelectionMode.RANDOM, val scalingMode: AnchorMeshScalingMode = AnchorMeshScalingMode.STRETCH, val matchAspectRatio: Boolean = false)

The AnchorMeshGroup contains the information needed to spawn a mesh for a label. See spawnGroups on the AnchorMeshSpawner.
Companion
object Companion

Properties

NameSummary
mrukFeature
val mrukFeature: MRUKFeature

The MRUKFeature to which this AnchorMeshSpawner is tied. The AnchorMeshSpawner gets its anchor data from the MRUKFeature.
spawnGroups
var spawnGroups: Map<MRUKLabel, AnchorMeshSpawner.AnchorMeshGroup>

A map of label to the meshes to spawn.
spawnMode
val spawnMode: MRUKSpawnMode

The spawnMode determines if the AnchorMeshSpawner should spawn meshes automatically whenever the mrukFeature has new anchors loaded. If the spawnMode is set to NONE spawnMeshes() needs to be invoked manually.

Functions

NameSummary
destroy
fun destroy()

Destroys the AnchorMeshSpawner. It’s important to call this function before the AnchorMeshSpawner gets out of scope because it might lead to memory leaks otherwise.
spawnMeshes
fun spawnMeshes(room: MRUKRoom): List<Entity>

Spawn meshes for a given room. This should only be invoked manually if spawnMode is set to NONE.



fun spawnMeshes(rooms: List<MRUKRoom>): List<Entity>

Spawn meshes for a given list of rooms. This should only be invoked manually if spawnMode is set to NONE.

Companion

object Companion

Properties

NameSummary
boundsCache
val boundsCache: <Error class: unknown class><String, Bound3D>

Functions

NameSummary
getMeshBounds
fun getMeshBounds(mesh: String): Bound3D
Did you find this page helpful?
Thumbs up icon
Thumbs down icon