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

AnchorProceduralMesh Class

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

Signature

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 anchorTexCoordMode: MRUKAnchorTexCoordMode = MRUKAnchorTexCoordMode.STRETCH, var cutHoleLabels: List<MRUKLabel> = listOf(MRUKLabel.WINDOW_FRAME, MRUKLabel.DOOR_FRAME))

Constructors

AnchorProceduralMesh ( mrukFeature , labelToConfig , spawnMode , wallTexCoordModeU , wallTexCoordModeV , anchorTexCoordMode , cutHoleLabels )
Signature
constructor(mrukFeature: MRUKFeature, labelToConfig: Map<MRUKLabel, AnchorProceduralMeshConfig>, spawnMode: MRUKSpawnMode = MRUKSpawnMode.CURRENT_ROOM_ONLY, wallTexCoordModeU: MRUKWallTexCoordModeU = MRUKWallTexCoordModeU.METRIC, wallTexCoordModeV: MRUKWallTexCoordModeV = MRUKWallTexCoordModeV.METRIC, anchorTexCoordMode: MRUKAnchorTexCoordMode = MRUKAnchorTexCoordMode.STRETCH, cutHoleLabels: List<MRUKLabel> = listOf(MRUKLabel.WINDOW_FRAME, MRUKLabel.DOOR_FRAME))
Parameters
mrukFeature: MRUKFeature
labelToConfig: Map
spawnMode: MRUKSpawnMode
wallTexCoordModeU: MRUKWallTexCoordModeU
wallTexCoordModeV: MRUKWallTexCoordModeV
anchorTexCoordMode: MRUKAnchorTexCoordMode
cutHoleLabels: List

Properties

anchorTexCoordMode : MRUKAnchorTexCoordMode
[Get][Set]
The texture coordinate mode for planes and volumes that are not walls. Depending on that mode the texture will appear differently.
Signature
var anchorTexCoordMode: MRUKAnchorTexCoordMode
cutHoleLabels : List
[Get][Set]
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.
Signature
var cutHoleLabels: List<MRUKLabel>
labelToConfig : Map
[Get][Set]
A mapping that tells the AnchorProceduralMesh for which labels procedural meshes should be generated.
Signature
var labelToConfig: Map<MRUKLabel, AnchorProceduralMeshConfig>
mrukFeature : MRUKFeature
[Get]
The MRUKFeature to which this AnchorProceduralMesh is tied. The AnchorProceduralMesh gets its anchor data from the MRUKFeature.
Signature
val mrukFeature: MRUKFeature
spawnMode : MRUKSpawnMode
[Get]
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.
Signature
val spawnMode: MRUKSpawnMode
wallTexCoordModeU : MRUKWallTexCoordModeU
[Get][Set]
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.
Signature
var wallTexCoordModeU: MRUKWallTexCoordModeU
wallTexCoordModeV : MRUKWallTexCoordModeV
[Get][Set]
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.
Signature
var wallTexCoordModeV: MRUKWallTexCoordModeV

Functions

destroy ()
Destroys the AnchorProceduralMesh. It's important to call this function before the AnchorProceduralMesh gets out of scope, otherwise it might lead to memory leaks.
Signature
fun destroy()
spawnMeshes ( rooms )
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<AnchorProceduralMesh.MeshAndPhysicEntity>
Parameters
rooms: List
Returns
List
spawnMeshes ( room )
Spawn meshes for a given room. This should only be invoked manually if spawnMode is set to NONE.
Signature
fun spawnMeshes(room: MRUKRoom): List<AnchorProceduralMesh.MeshAndPhysicEntity>
Parameters
room: MRUKRoom
Returns
List

Companion Object

Companion Object Properties

TAG : String
[Get]
Signature
const val TAG: String

Inner Class

MeshAndPhysicEntity Class

Modifiers: final
Container for mesh and physics entities spawned for an anchor.

Signature

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

Constructors

MeshAndPhysicEntity ( mesh , physics )
Signature
constructor(mesh: Entity?, physics: Entity?)
Parameters
mesh: Entity?
  The entity containing the visual mesh component, or null if no material was configured.
physics: Entity?
  The entity containing the physics collider component, or null if physics was not enabled.
Returns
AnchorProceduralMesh.MeshAndPhysicEntity

Properties

mesh : Entity?
[Get]
The entity containing the visual mesh component, or null if no material was configured.
Signature
val mesh: Entity?
physics : Entity?
[Get]
The entity containing the physics collider component, or null if physics was not enabled.
Signature
val physics: Entity?
Did you find this page helpful?