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

FindSpawnPositions Class

Extends MonoBehaviour
Allows for fast generation of valid (inside the room, outside furniture bounds) random positions for content spawning.
Optional method to pin directly to surfaces. This class leverages the MRUKRoom.GenerateRandomPositionInRoom and MRUKRoom.GenerateRandomPositionOnSurface methods to provide a simple interface for spawning content in the room.

Member Enumerations

Enumeration SpawnLocation

Defines possible locations where objects can be spawned.
Floating
No description available
AnySurface
No description available
VerticalSurfaces
No description available
OnTopOfSurfaces
No description available
HangingDown
No description available

Fields

When the scene data is loaded, this controls what room(s) the prefabs will spawn in.
Prefab to be placed into the scene, or object in the scene to be moved around.
Number of SpawnObject(s) to place into the scene per room, only applies to Prefabs.
Maximum number of times to attempt spawning/moving an object before giving up.
Attach content to scene surfaces.
When using surface spawning, use this to filter which anchor labels should be included.
Eg, spawn only on TABLE or OTHER.
If enabled then the spawn position will be checked to make sure there is no overlap with physics colliders including themselves.
Required free space for the object (Set negative to auto-detect using GetPrefabBounds) default to auto-detect.
This value represents the extents of the bounding box
Set the layer(s) for the physics bounding box checks, collisions will be avoided with these layers.
The clearance distance required in front of the surface in order for it to be considered a valid spawn position.

Member Functions

Starts the spawning process for all rooms.
Starts the spawning process for a specific room.
A maximum of MaxIterations attempts will be made to find a valid spawn position. MRUKRoom.GenerateRandomPositionInRoom and MRUKRoom.GenerateRandomPositionOnSurface are used to generate the positions.
Parameters
room
The room to spawn objects in.
Did you find this page helpful?
Thumbs up icon
Thumbs down icon