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

Event that gets fired when the interior spawner finished spawning actors.
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.
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.
Material to use when falling back to procedural material.
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.
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.
A map of Actor classes to spawn for the given label.

Member Functions

DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam
( FOnInteriorSpawned ,
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.
Return all spawned actors from the give room.
Parameters
Room
The room from which the actors should be returned
Actors
The spawned actors.
Return all spawned actors from all rooms.
Parameters
Actors
The spawned actors.

Protected Functions

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.
Parameters
Room
The room to spawn actors for.
RandomStream
A random stream to be used with the random selection mode.
Returns
A list of all spawned actors.
virtual TArray< AActor * > SpawnAnchorActorsInRoom_Implementation
( AMRUKRoom * Room,
const FRandomStream & 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.
Parameters
Anchor
The anchor to spawn a actor for.
Label
The label to spawn a actor for.
SpawnGroup
Information on which actor should be spawned.
RandomStream
A random stream for implementing the random selection logic.
Returns
The spawned actor.
virtual AActor * SpawnAnchorActorForLabel_Implementation
( AMRUKAnchor * Anchor,
const FString & Label,
const FMRUKSpawnGroup & SpawnGroup,
const FRandomStream & RandomStream )
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.
Parameters
Anchor
The anchor to spawn the actor for.
SpawnActor
Information on which actor should be spawned.
Returns
The spawned actor.
virtual AActor * SpawnAnchorActor_Implementation
( AMRUKAnchor * Anchor,
const FMRUKSpawnActor & SpawnActor )
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.
Parameters
Anchor
The anchor for which the actor gets spawned.
SpawnedActor
The actor that gets spawned.
StretchedScale
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
The scale that should be applied to the actor. In case it's a plane anchor only the X and Y component are relevant.
virtual FVector ComputeCustomScaling_Implementation
( AMRUKAnchor * Anchor,
AActor * SpawnedActor,
const FVector & StretchedScale )
Override this method to inject custom actor selection logic. This will be called for every actor that gets spawned by the AMRUKAnchorActorSpawner.
Parameters
Anchor
The anchor for which a actor should be spawned
SpawnGroup
The group of actors that can be used for decision making.
RandomStream
A random stream to randomize outputs if necessary.
OutSpawnActor
The actor which should be spawned.
Returns
Whether the selection process was successful or not.
virtual bool SelectSpawnActorCustom_Implementation
( AMRUKAnchor * Anchor,
const FMRUKSpawnGroup & SpawnGroup,
const FRandomStream & RandomStream,
FMRUKSpawnActor & OutSpawnActor )
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.
Parameters
Anchor
The anchor for which the actor gets spawned.
Actor
The actor that gets spawned.
ChildBounds
the rotated bounding box of the actor that should be spawned. For planes only X and Y components are relevant.
Scale
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
The offset that should be applied to the actor. In case it's a plane anchor only the X and Y component are relevant.
virtual FVector ComputeCustomAlign_Implementation
( AMRUKAnchor * Anchor,
AActor * Actor,
const FBox & ChildBounds,
const FVector & Scale )
Check if for the given SpawnGroup a procedural mesh should be spawned.
Parameters
SpawnGroup
The spawn group to check
Returns
Whether a procedural mesh should be spawned or not
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.
Parameters
Anchor
The anchor where the actor should be spawned
Label
The label of the anchor
OutSpawnGroup
Will be set in case a actor should be spawned
Returns
Whether or not a actor should be spawned for the anchor
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.
Parameters
Room
The room to spawn in.
Spawn a procedural mesh for the floor if no floor actor is given to the spawner.
Parameters
Room
The room to spawn in.
Spawn a procedural mesh for the ceiling if no ceiling actor is given to the spawner.
Parameters
Room
The room to spawn in.
Spawn a procedural mesh for the given anchor if the settings on the AnchorActorSpawner say so.
Parameters
Anchor
The anchor for which the procedural mesh should be spawned
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.
Parameters
Room
The room to spawn in.
Select the SpawnActor based on the size that matches best the anchor bounds.
Parameters
Anchor
The anchor for which a actor should be spawned.
SpawnGroup
The spawn group.
OutSpawnActor
The found spawn actor.
Returns
True if a SpawnActor could be found. Otherwise, false.
Select the SpawnActor randomly
Parameters
SpawnGroup
The spawn group.
RandomStream
The random stream to use for the random selection.
OutSpawnActor
The found spawn actor.
Returns
True if a SpawnActor could be found. Otherwise, false.
Select a SpawnActor from the SpawnGroup with respect to the given selection mode in SpawnGroup.
Parameters
Anchor
The anchor for which the actor should be spawned.
SpawnGroup
The spawn group.
RandomStream
The random stream
OutSpawnActor
The found spawn actor
Returns
True if a spawn actor has been found. Otherwise, false.
Orient and scale the given actor to the anchors plane or volume bounds.
Parameters
Anchor
The anchor
Actor
The actor which should be oriented and scaled to the given anchor.
ScalingMode
The scaling mode that should be used when doing the matching.
bCalculateFacingDirection
Whether or not the facing direction of the anchor should be calculated and used for the orientation process.
bMatchAspectRatio
Whether or not the aspect ratio of the anchor should be matched.
void BeginPlay ( )
void OnRoomCreated
( AMRUKRoom * Room )
void OnRoomUpdated
( AMRUKRoom * Room )
void OnRoomRemoved
( AMRUKRoom * Room )
void RemoveActors
( AMRUKRoom * Room )
Did you find this page helpful?
Thumbs up icon
Thumbs down icon