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

AnchorMeshSpawner Class

Modifiers: final
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.

Signature

class AnchorMeshSpawner(val mrukFeature: MRUKFeature, var spawnGroups: Map<MRUKLabel, AnchorMeshSpawner.AnchorMeshGroup>, val spawnMode: MRUKSpawnMode = MRUKSpawnMode.CURRENT_ROOM_ONLY)

Constructors

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

Properties

mrukFeature : MRUKFeature
[Get]
The MRUKFeature to which this AnchorMeshSpawner is tied. The AnchorMeshSpawner gets its anchor data from the MRUKFeature.
Signature
val mrukFeature: MRUKFeature
spawnGroups : Map
[Get][Set]
A map of label to the meshes to spawn.
Signature
var spawnGroups: Map<MRUKLabel, AnchorMeshSpawner.AnchorMeshGroup>
spawnMode : MRUKSpawnMode
[Get]
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.
Signature
val spawnMode: MRUKSpawnMode

Functions

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.
Signature
fun destroy()
spawnMeshes ( rooms ) : List
Spawn meshes for a given list of rooms. This should only be invoked manually if spawnMode is set to NONE.
Signature
fun spawnMeshes(rooms: List<MRUKRoom>): List<Entity>
Parameters
rooms: List
Returns
List
spawnMeshes ( room ) : List
Spawn meshes for a given room. This should only be invoked manually if spawnMode is set to NONE.
Signature
fun spawnMeshes(room: MRUKRoom): List<Entity>
Parameters
room: MRUKRoom
Returns
List

Companion Object

Companion Object Properties

boundsCache : HashMap<String, Bound3D>
[Get]
Signature
val boundsCache: HashMap<String, Bound3D><String, Bound3D>

Companion Object Functions

getMeshBounds ( mesh ) : Bound3D
Signature
fun getMeshBounds(mesh: String): Bound3D
Parameters
mesh: String
Returns

Inner Class

AnchorMeshGroup Class

Modifiers: final
The AnchorMeshGroup contains the information needed to spawn a mesh for a label. See spawnGroups on the AnchorMeshSpawner.

Signature

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

Constructors

AnchorMeshGroup ( meshes , selectionMode , scalingMode , matchAspectRatio ) : AnchorMeshSpawner.AnchorMeshGroup
Signature
constructor(meshes: List<String>, selectionMode: AnchorMeshSelectionMode = AnchorMeshSelectionMode.RANDOM, scalingMode: AnchorMeshScalingMode = AnchorMeshScalingMode.STRETCH, matchAspectRatio: Boolean = false)
Parameters
meshes: List
selectionMode: AnchorMeshSelectionMode
scalingMode: AnchorMeshScalingMode
matchAspectRatio: Boolean
Returns
AnchorMeshSpawner.AnchorMeshGroup

Properties

matchAspectRatio : Boolean
[Get]
Ensures that the mesh gets rotated in a way to match the aspect ratio of the anchor.
Signature
val matchAspectRatio: Boolean = false
meshes : List
[Get]
A list of meshes considered for spawning. The selection of meshes for spawning is determined by the selectionMode.
Signature
val meshes: List<String>
scalingMode : AnchorMeshScalingMode
[Get]
Determines the scaling mode that should be used when scaling a mesh from that group.
Signature
val scalingMode: AnchorMeshScalingMode
selectionMode : AnchorMeshSelectionMode
[Get]
Determines the selection method for the meshes in that group.
Signature
val selectionMode: AnchorMeshSelectionMode
Did you find this page helpful?
Thumbs up icon
Thumbs down icon