FANDOM


Master/SlaveEdit

The master script attaches to the master prefab, upon which a number of cycles have been defined.  Each cycle is linked to a prefab and one or more waypoints.  When the master prefab initializes the script spawns an instance of the prefabs for each cycle at the first waypoint on the cycle and then animates them according to its instructions.

The spawned prefabs must have the slave script attached to them.

  • In manual mode, when a user clicks on a slave prefab it will move to the next waypoint in its cycle, returning to the first one when it reaches the end.  Thus a cycle of 2 waypoints can be used to make a simple opening door or one level elevator.
  • In automatic mode, the slave prefab moves from waypoint to waypoint as instructed by the waypoint details.

Master ParamtersEdit

The parameters for the master are:

PrefabcEdit

The prefabs for the various cycles.  The c character is the cycle it the prefab is to be used for.  Initially only 0-9 are supported.

SoundaEdit

This lets you specify a number of sound files to be played as needed by the animation.  The a character is the sound (audio) id.  Initially only 0-9 are supported.

WaypointsEdit

Waypoints are markers that are added to the master object.  Their name fields are used to contain instructions for the master scripts.  There are 3 types of waypoint that are recognized by the Master script.

CYC csstttaddd

This defines a point in a cycle.  The characters are:
Cycle id - 0-9 at present
ss
Sequence number, numeric, 00 thru 99.  Note that a cycle must have a waypoint with sequence 00 for its prefab to be spawned.
ttt
Transition time in seconds - 1 to 999 are supported.  This is how long the slave prefab takes to move from its previous waypoint to this one.
a
Audio (Sound) id. The sound is played while the slave prefab is moving to the waypoint.
ddd
Dwell time - time in seconds that the slave prefab should remain at the waypoint - 000 thru 999 or ... if the slave prefab should remain at the waypoint until clicked.
This marker should not be set as being clickable.

REP cottt

This defines a replication of a cycle.  
c
The cycle id of the replica cycle.
o
The id of the cycle to be replicated.  The replicated cycle is offset from the origial cycle by the difference between the REP waypoint and the replicated cycles CYC sequence 00 waypoint.  If the REP waypoint was 2 meters away on the x axis, then the replicated cycle would run 2m away from the original.
ttt
The time delay in seconds (000-999) to be applied to the initial motion from the replicated cycle.  Useful for making things follow each other.
This marker should not be set as being clickable.

SWI wc[c[c[c[...]]]]

This defines a switch - when clicked the linked cycles will all advance to their next waypoint.  The w character is the switch id (0-9, A-Z, a-z) and the c characters are the cycle ids of the cycles to be switched.
This marker should be set as being clickable.

The master object should be set to be clickable only near markers and not to show all markers.

Waypoint markers should be placed such that the hotspot of the spawned prefab will be placed and aligned with the waypoint marker.  You will probably need to set the transform offset on the spawned prefab to get its hotspot to the position you want it in (on an edge or a corner for a traditional hinged door, for example).  Placing it at a corner can make it easier to align the waypoint marker.

If you find a slave object is rotating the wrong way between waypoints, you can insert additional waypoints with a dwell time of 000 on the path you wish it to follow.  Once clicked it will move to these additional waypoints and then automatically move onto the next one until it finds a waypoint with a dwell time of ... at which point it will stop until it is clicked on again.

Note that each spawned prefab counts as 1 temporary dynamic object - there are limits to the number that can be spawned.  In addition, the spawning of the prefabs themselves is paced to 4 in the first second and 1 per second thereafter, so a master object with 20 cycles defined would take 16 seconds to initialize itself and spawn all of its slave prefabs.

Slave ParametersEdit

There are none, the script simmply needs to be linked to the slave prefabs.

Note that you cannot use prefab customizers on the slave prefabs as the objects get dynamically spawed.  You can set customizers in the Modify tab however - as long as you remember to save the prefab afterwards.