Public classes


Scripts/

   Trivision
   TrivisionPrism
   TrivisionRunner


Introduction page

Trivision
Derived from MonoBehaviour


Main class of Trivision board. Board contains multiple rotating triangular prisms.


Enums

public enum OrientationsDifferent orientations for prisms.

Properties

public float GapBetweenPrismsSet or get size of gap between prisms, relative to prism size.
public bool GapsHidesImageSets or gets whatever gaps between prisms hides parts of the image that would be in gaps.
public float ObjectHeightSets or gets desired height for whole board object.
public float ObjectWidthSets or gets desired width for whole board object.
public Orientations OrientationSets or gets orientation of prisms.
public int PrismCountSets or gets number of prisms in board.
public float RandomMisalignmentSets or gets random misalignments of prisms.

Methods

public Material GetBaseMaterial ()Get current material used for prisms triangular bases.
public Material GetImageMaterial (int imageIndex)Get current image (material) used for certain side of prisms.
public TrivisionPrism GetPrism (int prismIndex)Get single prism from this Trivision board.
public TrivisionRunner GetRunner ()Get TrivionRunner script attached to this GameObject.
public void Init ()This method will initialize the trivison board by creating prisms.
public bool IsInitialized ()Check if this trivision board is initialized.
public void SetBaseMaterial (Material baseMaterial)Set material used for prisms triangular bases.
public void SetImageMaterial (int ïmageIndex, Material imageMaterial)Set image (material) used for certain side of prisms.
public void ShowImageInstantly (int imageIndex)Instantly set rotation all the prisms so that certain image is facing front.
public void StartTransitionsToImage (int imageIndex, float prismsRotationTimeSeconds, TrivisionPrism.RotationStyle prismsRotationStyle)Start slow transition of all the prisms so that eventually certain image is facing front.
public void reCreateInEditMode ()Method used only internally by custom inspector editor.

Enums

public enum Orientations

Different orientations for prisms.

ItemsHorizontalMake prisms horizontal.
 VerticalMake prisms vertical.


Properties

public float GapBetweenPrisms

Set or get size of gap between prisms, relative to prism size. 0 means no gap, 1 means same size gap as prisms themselves.

ValueGap amount.


public bool GapsHidesImage

Sets or gets whatever gaps between prisms hides parts of the image that would be in gaps. This have effect only if 'GapBetweenPrisms' is set to more than 0.

ValueIf true, parts of image will be missing. If false, all parts of image will be visible but image may get flatten or stretched.


public float ObjectHeight

Sets or gets desired height for whole board object. All prisms will be created to fit in this size.

ValueHeight in Unity units.


public float ObjectWidth

Sets or gets desired width for whole board object. All prisms will be created to fit in this size.

ValueWidth in Unity units.


public Orientations Orientation

Sets or gets orientation of prisms.

ValueOne of the values from enum Orientations.


public int PrismCount

Sets or gets number of prisms in board.

ValuePrism count.


public float RandomMisalignment

Sets or gets random misalignments of prisms. This can be added for extra realism so that all the prisms are not perfectly straight. 0 means no misalignments at all, 1 is maximum when all the prisms are slightly in wrong rotations.

ValueMisalignment percent.


Methods

public Material GetBaseMaterial ()

Get current material used for prisms triangular bases.

ReturnsCurrent material used.


public Material GetImageMaterial (int imageIndex)

Get current image (material) used for certain side of prisms.

ParametersimageIndexIndex of image to get, between 0 and 2.

ReturnsCurrent image (material) used.


public TrivisionPrism GetPrism (int prismIndex)

Get single prism from this Trivision board. This can be called only after this object Init() is called. Start() method will also call Init().

ParametersprismIndexIndex of prism to get. 0 is either topmost or leftmost prism, depending on orientation.

ReturnsPrism object.


public TrivisionRunner GetRunner ()

Get TrivionRunner script attached to this GameObject. Trivision prefab have runner script attached to it, but if for some reason this GameObject doesn't have TrivionRunner component, one will be created and added to this GameObject, and then returned.

ReturnsTrivisionRunner component in this GameObject.


public void Init ()

This method will initialize the trivison board by creating prisms. This method is also called automatically by Unity's Start() method, so typically there is no need to call this method manually.

This method doesn't do anything if already called once.


public bool IsInitialized ()

Check if this trivision board is initialized. Before initialization it is possible to change Trivision properties. After initialization possible TrivisionRunner can be started and prisms can be accessed by using GetPrism() method.

ReturnsTrue if initialized, false otherwise.


public void SetBaseMaterial (Material baseMaterial)

Set material used for prisms triangular bases. This can be changed also when application is running and after Trivision board is already created and initialized.

ParametersbaseMaterialMaterial to use. If null, default material will be used.


public void SetImageMaterial (int ïmageIndex, Material imageMaterial)

Set image (material) used for certain side of prisms. This can be changed also when application is running and after Trivision board is already created and initialized.

ParametersïmageIndexIndex of image to set, between 0 and 2.
 imageMaterialImage (material) to use. If null, default material will be used.


public void ShowImageInstantly (int imageIndex)

Instantly set rotation all the prisms so that certain image is facing front.

ParametersimageIndexImage to face front.


public void StartTransitionsToImage (int imageIndex, float prismsRotationTimeSeconds, TrivisionPrism.RotationStyle prismsRotationStyle)

Start slow transition of all the prisms so that eventually certain image is facing front.

ParametersimageIndexImage to face front eventually.
 prismsRotationTimeSecondsHow many seconds prism rotations should take.
 prismsRotationStyleStyle of rotations, one of the enum TrivisionPrism.RotationStyle


public void reCreateInEditMode ()

Method used only internally by custom inspector editor.