VTIObjectInstantiate

From WaffleSlapper's Project Wiki
Revision as of 04:34, 26 March 2024 by Steeveeo (talk | contribs) (Initial writeup.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


VTIObjectInstantiate is a VTI Driver that will instantiate copies of a Prefab GameObject when fired within a (zero-able) range of either the Streamer or the Target. When choosing a Prefab, note that its saved Transform will be used as an offset to its spawned position. For example, if your spawned object should always spawn above the head of a player, make sure the Position in the saved Prefab is set have a Y greater than 0.

NOTE: These spawned items are not syncable, do not use this Driver for persistent objects!

Driver Capabilities
Supports User Messaging No (This may change in the future)
Supports Dynamic Rebinding Yes
Network Sync Triggers on all Clients. Spawned objects WILL NOT SYNC to new joiners!
Inputs
Name Type Usage
Prefab GameObject The GameObject to copy when spawning objects. This can either be an object in the scene, or a Prefab from your Assets.
Item Container GameObject The GameObject to store spawned objects within. This is used to determine how many objects have been spawned when checking against MaxCount, so choose an object without pre-existing children. Defaults to this script's GameObject.
SpawnAtPlayer bool Whether or not to spawn the new object at the Streamer's feet or around the Target.
RandomSpawnOffsetAxes Vector3 How much to randomize the spawn position by in each axis. For instance, setting X to 10.0f will vary the spawn position's X axis by plus-or-minus 10 meters.
MaxCount int How many items can be spawned before this Driver stops spawning new ones. Set to -1 to not limit. Exercise caution when turning off limits when the spawned Prefab does not clean itself up!
SpawnDelay float How long to wait between setting the randomized spawn position and actually spawning the object. Use to ensure networking has a second to propagate the correct position before spawning.
SpawnCountRecheckDelay float How long in seconds to wait before updating the number of spawned items. Lower values will clear the buffer faster, but incur more load on the CPU.