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

AMRUKAnchorActorSpawner Class

Extends AActor
Spawns meshes on anchor positions. If the out of the box functionality doesn't match your goals the AnchorActorSpawner provides way to inject custom spawning logic into every step of it's spawning process by overwriting certain functions. For this please take a look at SpawnAnchorActorsForRoom(), SpawnAnchorActorForLabel(), and SpawnAnchorActor().

Fields

AnchorRandomSpawnSeed : int
Seed to use for the random generator that decideds wich actor class to spawn if there a given multiple for a label. negative values will have the effect to initialize the random generator to a random seed.
Signature
int AMRUKAnchorActorSpawner::AnchorRandomSpawnSeed
CutHoleLabels : TArray< FString >
Labels for which holes should be created in the parents plane mesh. E.g. if holes are needed in the walls where the windows and doors are, specify DOOR_FRAME and WINDOW_FRAME.
Signature
TArray<FString> AMRUKAnchorActorSpawner::CutHoleLabels
OnActorsSpawned : FOnInteriorSpawned
Event that gets fired when the interior spawner finished spawning actors.
Signature
FOnInteriorSpawned AMRUKAnchorActorSpawner::OnActorsSpawned
ProceduralMaterial : UMaterialInterface *
Material to use when falling back to procedural material.
Signature
UMaterialInterface* AMRUKAnchorActorSpawner::ProceduralMaterial
ShouldFallbackToProcedural : bool
Whether or not the spawner should fallback to procedural meshes in case no actor class has been defined for a label. This behaviour can be overwritten on the label basis in SpawnGroups.
Signature
bool AMRUKAnchorActorSpawner::ShouldFallbackToProcedural
SpawnGroups : TMap< FString, FMRUKSpawnGroup >
A map of Actor classes to spawn for the given label.
Signature
TMap<FString, FMRUKSpawnGroup> AMRUKAnchorActorSpawner::SpawnGroups
SpawnMode : EMRUKSpawnMode
Whether actors should be spawned automatically after the mixed reality utility kit has been initialized. This should not be changed after the scene has been loaded.
Signature
EMRUKSpawnMode AMRUKAnchorActorSpawner::SpawnMode

Protected Member Functions

AttachAndFitActorToAnchor ( Anchor , Actor , ScalingMode , AlignMode , bCalculateFacingDirection , bMatchAspectRatio )
Orient and scale the given actor to the anchors plane or volume bounds.
Signature
void AMRUKAnchorActorSpawner::AttachAndFitActorToAnchor(AMRUKAnchor *Anchor, AActor *Actor, EMRUKSpawnerScalingMode ScalingMode, EMRUKAlignMode AlignMode, bool bCalculateFacingDirection, bool bMatchAspectRatio)
Parameters
Anchor: AMRUKAnchor *  The anchor
Actor: AActor *  The actor which should be oriented and scaled to the given anchor.
ScalingMode: EMRUKSpawnerScalingMode  The scaling mode that should be used when doing the matching.
AlignMode: EMRUKAlignMode
bCalculateFacingDirection: bool  Whether or not the facing direction of the anchor should be calculated and used for the orientation process.
bMatchAspectRatio: bool  Whether or not the aspect ratio of the anchor should be matched.
Returns
void
BeginPlay ()
Signature
void AMRUKAnchorActorSpawner::BeginPlay() override
Returns
void
ComputeCustomAlign ( Anchor , Actor , ChildBounds , Scale )
Override this method to inject custom scaling logic into the orientation process of an actor. The scale that this method returns gets used to scale the actor that will be spawned.
Signature
FVector AMRUKAnchorActorSpawner::ComputeCustomAlign(AMRUKAnchor *Anchor, AActor *Actor, const FBox &ChildBounds, const FVector &Scale)
Parameters
Anchor: AMRUKAnchor *  The anchor for which the actor gets spawned.
Actor: AActor *  The actor that gets spawned.
ChildBounds: const FBox &  the rotated bounding box of the actor that should be spawned. For planes only X and Y components are relevant.
Scale: const FVector &  The scale that will be applied to the actor that will be spawned in place of the anchor. For planes only X and Y components are relevant.
Returns
FVector  The offset that should be applied to the actor. In case it's a plane anchor only the X and Y component are relevant.
ComputeCustomAlign_Implementation ( Anchor , Actor , ChildBounds , Scale )
Signature
virtual FVector AMRUKAnchorActorSpawner::ComputeCustomAlign_Implementation(AMRUKAnchor *Anchor, AActor *Actor, const FBox &ChildBounds, const FVector &Scale)
Parameters
Anchor: AMRUKAnchor *
Actor: AActor *
ChildBounds: const FBox &
Scale: const FVector &
Returns
FVector
ComputeCustomScaling ( Anchor , SpawnedActor , StretchedScale )
Override this method to inject custom scaling logic into the orientation process of an actor. The scale that this method returns gets used to scale the actor that will be spawned.
Signature
FVector AMRUKAnchorActorSpawner::ComputeCustomScaling(AMRUKAnchor *Anchor, AActor *SpawnedActor, const FVector &StretchedScale)
Parameters
Anchor: AMRUKAnchor *  The anchor for which the actor gets spawned.
SpawnedActor: AActor *  The actor that gets spawned.
StretchedScale: const FVector &  The scale that would need to be applied to the actor to make it match with the bounding box of the anchor. In case it's a plane anchor only the X and Y component of the scale are relevant.
Returns
FVector  The scale that should be applied to the actor. In case it's a plane anchor only the X and Y component are relevant.
ComputeCustomScaling_Implementation ( Anchor , SpawnedActor , StretchedScale )
Signature
virtual FVector AMRUKAnchorActorSpawner::ComputeCustomScaling_Implementation(AMRUKAnchor *Anchor, AActor *SpawnedActor, const FVector &StretchedScale)
Parameters
Anchor: AMRUKAnchor *
SpawnedActor: AActor *
StretchedScale: const FVector &
Returns
FVector
OnRoomCreated ( Room )
Signature
void AMRUKAnchorActorSpawner::OnRoomCreated(AMRUKRoom *Room)
Parameters
Room: AMRUKRoom *
Returns
void
OnRoomRemoved ( Room )
Signature
void AMRUKAnchorActorSpawner::OnRoomRemoved(AMRUKRoom *Room)
Parameters
Room: AMRUKRoom *
Returns
void
OnRoomUpdated ( Room )
Signature
void AMRUKAnchorActorSpawner::OnRoomUpdated(AMRUKRoom *Room)
Parameters
Room: AMRUKRoom *
Returns
void
RemoveActors ( Room )
Signature
void AMRUKAnchorActorSpawner::RemoveActors(AMRUKRoom *Room)
Parameters
Room: AMRUKRoom *
Returns
void
SelectSpawnActorClosestSize ( Anchor , SpawnGroup , OutSpawnActor )
Select the SpawnActor based on the size that matches best the anchor bounds.
Signature
bool AMRUKAnchorActorSpawner::SelectSpawnActorClosestSize(AMRUKAnchor *Anchor, const FMRUKSpawnGroup &SpawnGroup, FMRUKSpawnActor &OutSpawnActor)
Parameters
Anchor: AMRUKAnchor *  The anchor for which a actor should be spawned.
SpawnGroup: const FMRUKSpawnGroup &  The spawn group.
OutSpawnActor: FMRUKSpawnActor &  The found spawn actor.
Returns
bool  True if a SpawnActor could be found. Otherwise, false.
SelectSpawnActorCustom ( Anchor , SpawnGroup , RandomStream , OutSpawnActor )
Override this method to inject custom actor selection logic. This will be called for every actor that gets spawned by the AMRUKAnchorActorSpawner.
Signature
bool AMRUKAnchorActorSpawner::SelectSpawnActorCustom(AMRUKAnchor *Anchor, const FMRUKSpawnGroup &SpawnGroup, const FRandomStream &RandomStream, FMRUKSpawnActor &OutSpawnActor)
Parameters
Anchor: AMRUKAnchor *  The anchor for which a actor should be spawned
SpawnGroup: const FMRUKSpawnGroup &  The group of actors that can be used for decision making.
RandomStream: const FRandomStream &  A random stream to randomize outputs if necessary.
OutSpawnActor: FMRUKSpawnActor &  The actor which should be spawned.
Returns
bool  Whether the selection process was successful or not.
SelectSpawnActorCustom_Implementation ( Anchor , SpawnGroup , RandomStream , OutSpawnActor )
Signature
virtual bool AMRUKAnchorActorSpawner::SelectSpawnActorCustom_Implementation(AMRUKAnchor *Anchor, const FMRUKSpawnGroup &SpawnGroup, const FRandomStream &RandomStream, FMRUKSpawnActor &OutSpawnActor)
Parameters
Anchor: AMRUKAnchor *
SpawnGroup: const FMRUKSpawnGroup &
RandomStream: const FRandomStream &
OutSpawnActor: FMRUKSpawnActor &
Returns
bool
SelectSpawnActorFromSpawnGroup ( Anchor , SpawnGroup , RandomStream , OutSpawnActor )
Select a SpawnActor from the SpawnGroup with respect to the given selection mode in SpawnGroup.
Signature
bool AMRUKAnchorActorSpawner::SelectSpawnActorFromSpawnGroup(AMRUKAnchor *Anchor, const FMRUKSpawnGroup &SpawnGroup, const FRandomStream &RandomStream, FMRUKSpawnActor &OutSpawnActor)
Parameters
Anchor: AMRUKAnchor *  The anchor for which the actor should be spawned.
SpawnGroup: const FMRUKSpawnGroup &  The spawn group.
RandomStream: const FRandomStream &  The random stream
OutSpawnActor: FMRUKSpawnActor &  The found spawn actor
Returns
bool  True if a spawn actor has been found. Otherwise, false.
SelectSpawnActorRandom ( SpawnGroup , RandomStream , OutSpawnActor )
Select the SpawnActor randomly
Signature
bool AMRUKAnchorActorSpawner::SelectSpawnActorRandom(const FMRUKSpawnGroup &SpawnGroup, const FRandomStream &RandomStream, FMRUKSpawnActor &OutSpawnActor)
Parameters
SpawnGroup: const FMRUKSpawnGroup &  The spawn group.
RandomStream: const FRandomStream &  The random stream to use for the random selection.
OutSpawnActor: FMRUKSpawnActor &  The found spawn actor.
Returns
bool  True if a SpawnActor could be found. Otherwise, false.
ShouldAnchorFallbackToProceduralMesh ( SpawnGroup )
Check if for the given SpawnGroup a procedural mesh should be spawned.
Signature
bool AMRUKAnchorActorSpawner::ShouldAnchorFallbackToProceduralMesh(const FMRUKSpawnGroup &SpawnGroup) const
Parameters
SpawnGroup: const FMRUKSpawnGroup &  The spawn group to check
Returns
bool  Whether a procedural mesh should be spawned or not
ShouldSpawnActorForAnchor ( Anchor , Label , OutSpawnGroup )
Check if there should be spawned a actor for the given label. This function may return false in case the spawner should fallback to a procedural mesh.
Signature
bool AMRUKAnchorActorSpawner::ShouldSpawnActorForAnchor(AMRUKAnchor *Anchor, const FString &Label, FMRUKSpawnGroup &OutSpawnGroup) const
Parameters
Anchor: AMRUKAnchor *  The anchor where the actor should be spawned
Label: const FString &  The label of the anchor
OutSpawnGroup: FMRUKSpawnGroup &  Will be set in case a actor should be spawned
Returns
bool  Whether or not a actor should be spawned for the anchor
SpawnAnchorActor ( Anchor , SpawnActor )
This method gets called by the default implementation of SpawnAnchorActorForLabel() to spawn the anchor and orient and scale it correct to the given anchor. If you are planning to implement a custom spawning logic you likely want to use this function in the end to actually spawn the actor as it takes care of orientation and scaling of the actor with regards to the anchor bounds.
Signature
AActor * AMRUKAnchorActorSpawner::SpawnAnchorActor(AMRUKAnchor *Anchor, const FMRUKSpawnActor &SpawnActor)
Parameters
Anchor: AMRUKAnchor *  The anchor to spawn the actor for.
SpawnActor: const FMRUKSpawnActor &  Information on which actor should be spawned.
Returns
AActor *  The spawned actor.
SpawnAnchorActor_Implementation ( Anchor , SpawnActor )
Signature
virtual AActor * AMRUKAnchorActorSpawner::SpawnAnchorActor_Implementation(AMRUKAnchor *Anchor, const FMRUKSpawnActor &SpawnActor)
Parameters
Anchor: AMRUKAnchor *
SpawnActor: const FMRUKSpawnActor &
Returns
AActor *
SpawnAnchorActorForLabel ( Anchor , Label , SpawnGroup , RandomStream )
This method gets called by the default implementation of the SpawnAnchorActorsInRoom() for every label that should spawn a actor. By overwriting this function it is possible to inject custom spawning logic for actors on a per label basis. When implementing a custom spawning logic you may want to use SpawnAnchorActor() to spawn the actual actor and take care of it's orientation and scaling to match the anchors bounds.
Signature
AActor * AMRUKAnchorActorSpawner::SpawnAnchorActorForLabel(AMRUKAnchor *Anchor, const FString &Label, const FMRUKSpawnGroup &SpawnGroup, const FRandomStream &RandomStream)
Parameters
Anchor: AMRUKAnchor *  The anchor to spawn a actor for.
Label: const FString &  The label to spawn a actor for.
SpawnGroup: const FMRUKSpawnGroup &  Information on which actor should be spawned.
RandomStream: const FRandomStream &  A random stream for implementing the random selection logic.
Returns
AActor *  The spawned actor.
SpawnAnchorActorForLabel_Implementation ( Anchor , Label , SpawnGroup , RandomStream )
Signature
virtual AActor * AMRUKAnchorActorSpawner::SpawnAnchorActorForLabel_Implementation(AMRUKAnchor *Anchor, const FString &Label, const FMRUKSpawnGroup &SpawnGroup, const FRandomStream &RandomStream)
Parameters
Anchor: AMRUKAnchor *
Label: const FString &
SpawnGroup: const FMRUKSpawnGroup &
RandomStream: const FRandomStream &
Returns
AActor *
SpawnAnchorActorsInRoom ( Room , RandomStream )
This method gets called by the AnchorActorSpawner when it wants to spawn actors and procedural meshes in the room. It's possible to overwrite this function in Blueprint or C++ to implement custom spawning logic. The protected methods in the AnchorActorSpawner contain helper functions which can be useful when implementing a custom spawning logic. When implementing a custom spawning logic you may want to use SpawnAnchorActor() to spawn the actual actor and take care of it's orientation and scaling to match the anchors bounds.
Signature
TArray< AActor * > AMRUKAnchorActorSpawner::SpawnAnchorActorsInRoom(AMRUKRoom *Room, const FRandomStream &RandomStream)
Parameters
Room: AMRUKRoom *  The room to spawn actors for.
RandomStream: const FRandomStream &  A random stream to be used with the random selection mode.
Returns
TArray< AActor * >  A list of all spawned actors.
SpawnAnchorActorsInRoom_Implementation ( Room , RandomStream )
Signature
virtual TArray< AActor * > AMRUKAnchorActorSpawner::SpawnAnchorActorsInRoom_Implementation(AMRUKRoom *Room, const FRandomStream &RandomStream)
Parameters
Room: AMRUKRoom *
RandomStream: const FRandomStream &
Returns
TArray< AActor * >
SpawnProceduralMeshesInRoom ( Room )
Spawn procedural meshes for every anchor that needs them. Including walls, ceiling and floor. The method determines if procedural mesh should be spawned or not based on the settings of the AnchorActorSpawner.
Signature
TArray< AActor * > AMRUKAnchorActorSpawner::SpawnProceduralMeshesInRoom(AMRUKRoom *Room)
Parameters
Room: AMRUKRoom *  The room to spawn in.
Returns
TArray< AActor * >
SpawnProceduralMeshesOnWallsIfNoWallActorGiven ( Room )
Spawn a procedural mesh for all walls if no wall actor is given to the spawner. This will take care of generating seamless UVs for the walls.
Signature
TArray< AActor * > AMRUKAnchorActorSpawner::SpawnProceduralMeshesOnWallsIfNoWallActorGiven(AMRUKRoom *Room)
Parameters
Room: AMRUKRoom *  The room to spawn in.
Returns
TArray< AActor * >
SpawnProceduralMeshForAnchorIfNeeded ( Anchor )
Spawn a procedural mesh for the given anchor if the settings on the AnchorActorSpawner say so.
Signature
AActor * AMRUKAnchorActorSpawner::SpawnProceduralMeshForAnchorIfNeeded(AMRUKAnchor *Anchor)
Parameters
Anchor: AMRUKAnchor *  The anchor for which the procedural mesh should be spawned
Returns
AActor *
SpawnProceduralMeshOnCeilingIfNoCeilingActorGiven ( Room )
Spawn a procedural mesh for the ceiling if no ceiling actor is given to the spawner.
Signature
TArray< AActor * > AMRUKAnchorActorSpawner::SpawnProceduralMeshOnCeilingIfNoCeilingActorGiven(AMRUKRoom *Room)
Parameters
Room: AMRUKRoom *  The room to spawn in.
Returns
TArray< AActor * >
SpawnProceduralMeshOnFloorIfNoFloorActorGiven ( Room )
Spawn a procedural mesh for the floor if no floor actor is given to the spawner.
Signature
TArray< AActor * > AMRUKAnchorActorSpawner::SpawnProceduralMeshOnFloorIfNoFloorActorGiven(AMRUKRoom *Room)
Parameters
Room: AMRUKRoom *  The room to spawn in.
Returns
TArray< AActor * >

Member Functions

DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam ()
Signature
AMRUKAnchorActorSpawner::DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnInteriorSpawned, AMRUKRoom *, Room)
Parameters
FOnInteriorSpawned
Room
GetSpawnedActors ( Actors )
Return all spawned actors from all rooms.
Signature
void AMRUKAnchorActorSpawner::GetSpawnedActors(TArray< AActor * > &Actors)
Parameters
Actors: TArray< AActor * > &  The spawned actors.
Returns
void
GetSpawnedActorsByRoom ( Room , Actors )
Return all spawned actors from the give room.
Signature
void AMRUKAnchorActorSpawner::GetSpawnedActorsByRoom(AMRUKRoom *Room, TArray< AActor * > &Actors)
Parameters
Room: AMRUKRoom *  The room from which the actors should be returned
Actors: TArray< AActor * > &  The spawned actors.
Returns
void
SpawnActors ( Room )
Spawns the meshes for the given labels above on the anchor positions in each room. There might be multiple actor classes for a give label. If thats the case a actor class will be chosen radomly. The seed for this random generator can be set by AnchorRandomSpawnSeed. This function will be called automatically after the mixed reality utility kit initialized unless the option SpawnOnStart is set to false. If there is no actor class specified for a label then a procedural mesh matching the anchors volume and plane will be generated.
Signature
void AMRUKAnchorActorSpawner::SpawnActors(AMRUKRoom *Room)
Parameters
Room: AMRUKRoom *
Returns
void