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

AnchorProceduralMesh

AnchorProceduralMesh

class AnchorProceduralMesh(val mrukFeature: MRUKFeature, var labelToConfig: Map<MRUKLabel, AnchorProceduralMeshConfig>, val spawnMode: MRUKSpawnMode = MRUKSpawnMode.CURRENT_ROOM_ONLY, var wallTexCoordModeU: MRUKWallTexCoordModeU = MRUKWallTexCoordModeU.METRIC, var wallTexCoordModeV: MRUKWallTexCoordModeV = MRUKWallTexCoordModeV.METRIC, var cutHoleLabels: List<MRUKLabel> = listOf(MRUKLabel.WINDOW_FRAME, MRUKLabel.DOOR_FRAME))
The AnchorProceduralMesh is designed to automatically generate meshes for the given labels in a room. It is able to generate planes and boxes. In addition, it’s possible to cut holes into planes. This can be useful for windows. It’s also possible to spawn physics colliders for the generated meshes. AnchorProceduralMesh 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. If you want to be able to spawn 3D meshes from glb or gltf files refer to AnchorMeshSpawner. It is crucial to invoke the destroy() method when the AnchorMeshSpawner instance is no longer in use.

Constructors

NameSummary
AnchorProceduralMesh
constructor(mrukSystem: MRUKSystem, labelToConfig: Map<MRUKLabel, AnchorProceduralMeshConfig>, spawnMode: MRUKSpawnMode = MRUKSpawnMode.CURRENT_ROOM_ONLY, wallTexCoordModeU: MRUKWallTexCoordModeU = MRUKWallTexCoordModeU.METRIC, wallTexCoordModeV: MRUKWallTexCoordModeV = MRUKWallTexCoordModeV.METRIC, cutHoleLabels: List<MRUKLabel> = listOf(MRUKLabel.WINDOW_FRAME, MRUKLabel.DOOR_FRAME))constructor(mrukFeature: MRUKFeature, labelToConfig: Map<MRUKLabel, AnchorProceduralMeshConfig>, spawnMode: MRUKSpawnMode = MRUKSpawnMode.CURRENT_ROOM_ONLY, wallTexCoordModeU: MRUKWallTexCoordModeU = MRUKWallTexCoordModeU.METRIC, wallTexCoordModeV: MRUKWallTexCoordModeV = MRUKWallTexCoordModeV.METRIC, cutHoleLabels: List<MRUKLabel> = listOf(MRUKLabel.WINDOW_FRAME, MRUKLabel.DOOR_FRAME))

Types

NameSummary
Companion
object Companion
data class MeshAndPhysicEntity(val mesh: Entity?, val physics: Entity?)

Properties

NameSummary
cutHoleLabels
var cutHoleLabels: List<MRUKLabel>
A list of labels that cut holes into their parent anchors. For example, a door or windows parent will be the wall. That means if this list contains the window and door label, holes will be cut into the wall meshes. The anchor hierarchy gets determined by which anchors sit on top of other anchors.
labelToConfig
var labelToConfig: Map<MRUKLabel, AnchorProceduralMeshConfig>
A mapping that tells the AnchorProceduralMesh for which labels procedural meshes should be generated.
mrukFeature
val mrukFeature: MRUKFeature
The MRUKFeature to which this AnchorProceduralMesh is tied. The AnchorProceduralMesh gets its anchor data from the MRUKFeature.
spawnMode
val spawnMode: MRUKSpawnMode
The spawnMode determines if the AnchorProceduralMesh should spawn meshes automatically whenever the mrukFeature has new anchors loaded. If the spawnMode is set to NONE spawnMeshes() needs to be invoked manually.
wallTexCoordModeU
var wallTexCoordModeU: MRUKWallTexCoordModeU
The texture coordinate mode for the U channel that should be used when generating wall meshes. Depending on that mode the texture will appear differently.
wallTexCoordModeV
var wallTexCoordModeV: MRUKWallTexCoordModeV
The texture coordinate mode for the V channel that should be used when generating wall meshes. Depending on that mode the texture will appear differently.

Functions

NameSummary
destroy
fun destroy()
Destroys the AnchorMeshSpawner. It’s important to call this function before the AnchorMeshSpawner gets out of scope, otherwise it might lead to memory leaks.
spawnMeshes
fun spawnMeshes(room: MRUKRoom): List<AnchorProceduralMesh.MeshAndPhysicEntity>
Spawn meshes for a given room. This should only be invoked manually if spawnMode is set to NONE.
fun spawnMeshes(rooms: List<MRUKRoom>): List<AnchorProceduralMesh.MeshAndPhysicEntity>
Spawn meshes for a given list of rooms. This should only be invoked manually if spawnMode is set to NONE.

Companion

object Companion
Did you find this page helpful?
Thumbs up icon
Thumbs down icon