Classes | Public Types | Static Functions | Static Attributes | Properties | List of all members
Headjack.App Class Reference
Inheritance diagram for Headjack.App:

Classes

class  AppMetadata
 Container class for app metadata, used by App.GetAppMetadata(). More...
 
class  CategoryMetadata
 Container class for Category metadata, used by App.GetCategoryMetadata(string categoryId). More...
 
class  MediaMetadata
 Container class with metadata about a media item (project thumbnail, extra media item) More...
 
class  ProjectMetadata
 Container class with metadata about a Project More...
 
class  VideoMetadata
 Container class for video metadata, used by App.GetVideoMetadata(string). More...
 

Public Types

enum  ByteConversionType { bytes, Kilobytes, Megabytes, Gigabytes }
 Order of magnitude of filesizes, used by App.GetProjectMetadata(string, ByteConversionType).
 
enum  RaycastSource { Gaze, MotionController, Touch }
 Where the raycast is coming from More...
 
enum  VRPlatform { NotYetInitialized, OpenVR, Oculus, Cardboard }
 VR platform that Headjack is running on More...
 

Static Functions

static void Cancel (string ProjectId)
 Cancel an active download More...
 
static void Delete (string ProjectId)
 Delete all local files of a project More...
 
static void DestroyVideoPlayer ()
 Destroys the active videoplayer More...
 
static void Download (string ProjectId, bool WifiOnly=false, OnEnd onEnd=null)
 Download all files in a project More...
 
static void DownloadAllTextures (OnEnd OnLoaded=null)
 Download and import all textures More...
 
static void DownloadSingleMedia (string mediaId, bool wifiOnly, OnEnd onEnd=null)
 Download a single media item (e.g. extra media) More...
 
static void DownLoadSingleTexture (string MediaId, OnEnd OnLoaded=null)
 Download and import a texture More...
 
static void Fade (bool ToBlack, float Time=1, OnEnd OnFade=null)
 Fade screen to or from black More...
 
static List< string > GetAdditionalMedia ()
 Get IDs of extra media items from server More...
 
static AppMetadata GetAppMetadata ()
 Get metadata for the app More...
 
static string [] GetCategories ()
 Containts all category ids More...
 
static CategoryMetadata GetCategoryMetadata (string categoryId)
 Get metadata for category More...
 
static Color GetColor (string Key, Color DefaultValue)
 Get the app colors, from the server More...
 
static string GetCustomVariable (string key)
 Access custom template variables, downloaded from Headjack More...
 
static string GetDescription (string ProjectId)
 Get the Description of the given project More...
 
static Texture2D GetImage (string Id)
 Get a downloaded texture from te server More...
 
static MediaMetadata GetMediaMetadata (string mediaId)
 Get metadata for media item More...
 
static ProjectMetadata GetProjectMetadata (string projectId, ByteConversionType FileSizeFormat=ByteConversionType.Megabytes)
 Get metadata of project More...
 
static float GetProjectProgress (string ProjectId)
 Get the download progress of a project (0 to 100) More...
 
static string [] GetProjects (string CategoryId=null, int MaxPageSize=-1, int CurrentPage=0)
 Contains all available projects from the server More...
 
static string GetTitle (string ProjectId)
 Get the title of the given project More...
 
static VideoMetadata GetVideoMetadata (string Id)
 Get metadata for video associated with project ID More...
 
static bool GotFiles (string ProjectId)
 Check if you have all the files of a project More...
 
static void Initialize (OnEnd OnReady, bool autoCreateCamera=true, bool cardboardStereoMode=true)
 
static bool IsCrosshairHit (GameObject target, out RaycastHit hitInfo, RaycastSource raycastSource=RaycastSource.Gaze)
 Returns true if the user is looking at the target More...
 
static bool IsCrosshairHit (Collider target, RaycastSource raycastSource=RaycastSource.Gaze)
 
static bool IsCrosshairHit (GameObject target, RaycastSource raycastSource=RaycastSource.Gaze)
 
static bool IsCrosshairHit (Collider target, out RaycastHit hitInfo, RaycastSource raycastSource=RaycastSource.Gaze)
 
static void Play (string ProjectId, bool Stream, bool WifiOnly, OnEnd onEnd=null)
 Play a project More...
 
static bool ProjectIsDownloading (string ProjectId)
 Check if a project is currently downloading More...
 
static bool ProjectIsLiveStream (string ProjectId)
 Check if a project contains a live stream More...
 
static void Recenter ()
 Recenter orientation and position on your device More...
 
static void SetCamera (bool visible=true, bool vrMode=true)
 Enable or Disable the VR Camera. Enable or Disable cardboard VR mode More...
 
static void SetCameraBackground (Color backgroundColor)
 Set background color More...
 
static void SetCameraBackground (Material skybox)
 
static void ShowMessage (string Message, float TimeInSeconds=3, OnEnd onEnd=null)
 PopUp Messages for displaying a text More...
 
static bool UpdateAvailable (string Id)
 Check if a project or media file has an update available More...
 

Static Attributes

new static Transform camera
 Camera information More...
 
static GameObject CameraParent
 VR Camera GameObject More...
 
static Crosshair Crosshair
 Crosshair More...
 
static RaycastHit CrosshairHit
 All raycast information about what the user is looking at More...
 
static string CurrentProject
 The id of the project that is currently being played More...
 
static string CurrentVideo
 The id of the video that is currently being played More...
 
static RaycastHit LaserHit
 All raycast information about what the user is pointing at with the motion controller More...
 
static VideoPlayer Player
 
static RaycastHit TouchHit
 All raycast information about what the user is touching on screen (Cardboard) More...
 

Properties

static float CameraScale [get, set]
 Changing the camera scale will Shrink or Enlarge the world around you. Usefull if an interface needs to get just a little bigger or smaller More...
 
static VRPlatform CurrentPlatform [get]
 Checks the current platform More...
 
static bool EnableOVRPlatformMenu [get, set]
 If true, the back button on the GearVR will open the Oculus Platform Menu. You can disable this when the user goes out of the menu and in a video. More...
 
static bool IsPublished [get]
 Returns whether app has published state set in Headjack More...
 
static bool IsVRMode [get]
 Returns whether app is currently running in VR mode (e.g. stereo display), or not (e.g. fullscreen cardboard menu) More...
 
static bool ShowCrosshair [get, set]
 Headjack's crosshair More...
 

Member Enumeration Documentation

§ RaycastSource

Where the raycast is coming from

Note
MotionController will currently only work in HTC Vive Builds

§ VRPlatform

VR platform that Headjack is running on

Note
For testing: You can change this in the Headjack settings window

Member Function Documentation

§ Cancel()

static void Headjack.App.Cancel ( string  ProjectId)
inlinestatic

Cancel an active download

Parameters
ProjectIdProject download to cancel

Example

public void CancelAllDownloads()
{
string[] projects = App.GetProjects();
foreach (string project in projects)
{
App.Cancel(project);
}
}

§ Delete()

static void Headjack.App.Delete ( string  ProjectId)
inlinestatic

Delete all local files of a project

Parameters
ProjectIdThe project id

Example

public void DeleteAllProjects()
{
string[] projects = App.GetProjects();
foreach (string project in projects)
{
App.Delete(project);
}
}

§ DestroyVideoPlayer()

static void Headjack.App.DestroyVideoPlayer ( )
inlinestatic

Destroys the active videoplayer

Example

GameObject menuObject;
public void BackToMenu()
{
App.DestroyVideoPlayer();
menuObject.SetActive(true);
}

§ Download()

static void Headjack.App.Download ( string  ProjectId,
bool  WifiOnly = false,
OnEnd  onEnd = null 
)
inlinestatic

Download all files in a project

Parameters
ProjectIdThe project you want to download
WifiOnlyOnly download when connected to internet
onEndWill be called when the download is finished
Note
Will call onEnd with (false,"NoWifi") if WifiOnly is true and there is no wifi connection

Example

public string id;
public void DownloadAndPlayFirstVideo()
{
id = App.GetProjects()[0];
App.Download(id, true, OnDownloaded);
}
public void OnDownloaded(bool succes, string error)
{
if (succes)
{
App.Play(id, false, false, null);
}
}

§ DownloadAllTextures()

static void Headjack.App.DownloadAllTextures ( OnEnd  OnLoaded = null)
inlinestatic

Download and import all textures

Parameters
OnLoadedWill be called when done
Note
Will only download textures once, or when they are updated on the server

Example

public void LoadTextures()
{
App.LoadAllTextures(OnReady);
}
public void OnReady(bool Succes)
{
if (Succes)
{
print("Got all textures!");
}else
{
print("Could not download the textures");
}
}

§ DownloadSingleMedia()

static void Headjack.App.DownloadSingleMedia ( string  mediaId,
bool  wifiOnly,
OnEnd  onEnd = null 
)
inlinestatic

Download a single media item (e.g. extra media)

Parameters
mediaIdID of media item that will be downloaded
wifiOnlySet to true to only download over wifi and not use mobile data
onEndThis delegate is called when the download has finished (or failed)
Note
mediaId must be a media item either in extra media or a thumbnail of a project or category used in the app
Videos in projects are special entries on the server and do not have a media ID
onEnd returned bool indicates success of download, string contains error message of success is false

Example

// download first extra media item (over wifi only)
public void DownloadFirstExtraMedia()
{
if (App.GetAdditionalMedia().Count > 0)
{
App.DownloadSingleMedia(App.GetAdditionalMedia()[0], true,
delegate (bool success, string error)
{
if (success)
{
Debug.Log("Downloaded first extra media item");
}
else
{
Debug.LogError("Downloading first extra media item failed!");
}
});
}
}

§ DownLoadSingleTexture()

static void Headjack.App.DownLoadSingleTexture ( string  MediaId,
OnEnd  OnLoaded = null 
)
inlinestatic

Download and import a texture

Parameters
MediaIdThe media id of the texture file
OnLoadedWill be called when done
Note
Will only download the texture once, or when it is updated on the server

Example

public void DownLoadSingleTexture()
{
App.LoadAllTextures("12345678",OnReady);
}
public void OnReady(bool Succes)
{
if (Succes)
{
print("Got the texture!");
}else
{
print("Could not download the texture");
}
}

§ Fade()

static void Headjack.App.Fade ( bool  ToBlack,
float  Time = 1,
OnEnd  OnFade = null 
)
inlinestatic

Fade screen to or from black

Parameters
ToBlackTrue to fade to black (fade out), false to fade from black (fade in)
TimeDuration of the fade effect in seconds
OnFadeEvent function that gets executed when fade is completed
Note
Use this function to hide stutter, by fading to black before heavy loading
The parameters of OnFade (bool success, string error) are unused

Example

UnityEngine.GameObject interface;
// This function fades the screen to black for 1.5 seconds and then disables the 'interface' GameObject
// Another function has to fade the screen back in, or the screen will remain black
void FadeOutInterface()
{
App.Fade(true, 1.5f, delegate (bool success, string error) {interface.SetActive(false);});
}

§ GetAdditionalMedia()

static List<string> Headjack.App.GetAdditionalMedia ( )
inlinestatic

Get IDs of extra media items from server

Returns
List of ID strings of extra media items as entered on Headjack "Edit app" page
Note
Download a media item from this list using App.DownloadSingleMedia(string, bool, OnEnd)
Load the downloaded media as texture using App.LoadSingleTexture(string, OnEnd)
Get metadata for media item using App.GetMediaMetadata(string)

Example

// return number of extra media items
public int GetNumberOfExtraMedia()
{
return App.GetAdditionalMedia().Count;
}

§ GetAppMetadata()

static AppMetadata Headjack.App.GetAppMetadata ( )
inlinestatic

Get metadata for the app

Returns
App.AppMetadataclass containing metadata for App

Example

bool IsMyAppPublished()
{
}

§ GetCategories()

static string [] Headjack.App.GetCategories ( )
inlinestatic

Containts all category ids

Returns
a string array containing all category ids

§ GetCategoryMetadata()

static CategoryMetadata Headjack.App.GetCategoryMetadata ( string  categoryId)
inlinestatic

Get metadata for category

Parameters
categoryIdID of category
Returns
App.MediaData class containing metadata for media item, or null when invalid mediaId

Example

// return a list of all category names
public List<String> AllCategoryNames
{
List<String> names = new List<String>();
foreach(string id in App.GetCategories())
{
names.Add(App.GetCategoryMetadata(id).Name);
}
return names;
}

§ GetColor()

static Color Headjack.App.GetColor ( string  Key,
Color  DefaultValue 
)
inlinestatic

Get the app colors, from the server

Returns
Returns the color given in Key

Example

public Color GetBackgroundColor(string key)
{
return App.GetColor(key,Color.black);
}

§ GetCustomVariable()

static string Headjack.App.GetCustomVariable ( string  key)
inlinestatic

Access custom template variables, downloaded from Headjack

Returns
Returns the string value corresponding to the custom variable key, or null of key does not exist
Parameters
keyString key/name identifying the custom variable

Example

// Get a Texture object of an additional media item, whose id is passed to this
// template using a custom variable called "menu_background_image_id"
public Texture2D getBackgroundTexture()
{
return App.GetImage(App.GetCustomVariable("menu_background_image_id"));
}

§ GetDescription()

static string Headjack.App.GetDescription ( string  ProjectId)
inlinestatic

Get the Description of the given project

Parameters
ProjectIdThe project id
Returns
The description of the project with ProjectId, null if the project has no description
Note
To get a list with available projects, use App.GetProjects
Warning
When using this, make sure to check if the string is not null before using to avoid NullReference errors

Example

public string GetFirstDescription()
{
string[] ids = App.GetProjects();
return App.GetTitle(ids[0]);
}

§ GetImage()

static Texture2D Headjack.App.GetImage ( string  Id)
inlinestatic

Get a downloaded texture from te server

Parameters
IdProject id or media id
Returns
Texture 2d of given project/media id. Returns null if the media file doesn exists. Returns null if the given project doesn't have a thumbnail attached
Warning
When using this, make sure to check if the Texture is not null before using to avoid NullReference errors

Example

public void ApplyTexture(string AdditionalMediaId)
{
GetComponent<MeshRenderer>().material.mainTexture = App.GetImage(AdditionalMediaId);
}

§ GetMediaMetadata()

static MediaMetadata Headjack.App.GetMediaMetadata ( string  mediaId)
inlinestatic

Get metadata for media item

Parameters
mediaIdID of media item
Returns
App.MediaData class containing metadata for media item, or null when invalid mediaId
Note
mediaId must be a media item either in extra media or a thumbnail of a project or category used in the app
Videos in projects are special entries on the server and do not have a media ID

Example

// return filesize of first png image in extra media list (or -1 if no png image in list)
public long GetFirstPNGSize()
{
for (int i = 0; i < App.GetAdditionalMedia().Count; ++i)
{
App.MediaData currentMediaData = App.GetMediaMetadata(App.GetAdditionalMedia()[i]);
if (currentMediaData.MimeType == "image/png")
{
return currentMediaData.FileSize;
}
}
return -1;
}

§ GetProjectMetadata()

static ProjectMetadata Headjack.App.GetProjectMetadata ( string  projectId,
ByteConversionType  FileSizeFormat = ByteConversionType.Megabytes 
)
inlinestatic

Get metadata of project

Parameters
projectIdProject ID whose video metadata to retrieve
FileSizeFormatFilesize format of App.ProjectData.TotalSize in return class
Returns
App.ProjectDataclass containing metadata for project, null when projectId is invalid
Note
Use App.GetProjects(string, int, int) to get a list of Project IDs for this App
Some variables in the returned App.ProjectData class can be null if the project is missing data (e.g. does not have a thumbnail)

Example

// Set text of 3D Text Mesh to filesize (in MB) of project with projectId
void SetProjectSize(string projectId, UnityEngine.TextMesh projectSizeText)
{
float projectSize = Headjack.App.GetProjectMetadata(projectId, Headjack.App.ByteConversionType.Megabytes).TotalSize;
// set 3D text to <projectSize> MB (projectSize is rounded to 2 decimal points)
projectSizeText.text = projectSize.ToString("2n") + " MB";
}

§ GetProjectProgress()

static float Headjack.App.GetProjectProgress ( string  ProjectId)
inlinestatic

Get the download progress of a project (0 to 100)

Parameters
ProjectIdThe project to check
Returns
The download progress from 0 to 100, -1 on fail
Note
The returned value is not rounded, for displaying smooth loading bars

Example

public string GetProgressText(string projectid)
{
if(!App.ProjectIsDownloading(projectid))
{
return null;
}
float progress = App.GetProjectProgress(projectid);
return Mathf.FloorToInt(progress).ToString() + "%";
}

§ GetProjects()

static string [] Headjack.App.GetProjects ( string  CategoryId = null,
int  MaxPageSize = -1,
int  CurrentPage = 0 
)
inlinestatic

Contains all available projects from the server

Parameters
CategoryIdOnly return projects that fit in this category filter
MaxPageSizeOnly return a part from the list
CurrentPageThe part of the list to return. Starting at 0
Returns
A list with project ids
Note
Use App.GetCategoryList To get all available categories.

Example

//In this case, 5 projects per page
public string[] WhatsOnTheFirstPage
{
return App.GetProjects(null,5,0);
}
public string[] WhatsOnTheLastPage
{
return App.GetProjects(null,5,int.MaxValue);
}

§ GetTitle()

static string Headjack.App.GetTitle ( string  ProjectId)
inlinestatic

Get the title of the given project

Parameters
ProjectIdThe project id
Returns
The title of the project with ProjectId
Note
To get a list with available projects, use App.GetProjects(string, int, int)

Example

public string GetFirstTitle()
{
string[] ids = App.GetProjects();
return App.GetTitle(ids[0]);
}

§ GetVideoMetadata()

static VideoMetadata Headjack.App.GetVideoMetadata ( string  Id)
inlinestatic

Get metadata for video associated with project ID

Parameters
IdProject ID whose video metadata to retrieve
Returns
App.VideoDataclass containing metadata for video item, or null when invalid Project ID or project without video
Note
Use App.GetProjects(string, int, int) to get a list of Project IDs for this App
To get filesize and other information about a project, use App.GetProjectMetadata(string, ByteConversionType)

Example

// Returns string with duration of video in n-th project (first = 0, second = 1, etc. project in App)
// in format MM:SS (M = minutes, S = seconds)
string GetFormattedVideoDuration(int projectIndex)
{
string[] projects = Headjack.App.GetProjects();
// if projectIndex is invalid (negative or larger than number of projects), return empty string
if (projectIndex < 0 || projectIndex >= projects.Length)
{
return "";
}
return Headjack.App.GetVideoMetadata(projects[projectIndex]).DurationMMSS;
}

§ GotFiles()

static bool Headjack.App.GotFiles ( string  ProjectId)
inlinestatic

Check if you have all the files of a project

Parameters
ProjectIdProject to check
Returns
True if you have all the files
Note
Does not check if you have the latest version of the files, for that see App.UpdateAvailable

Example

public void StreamOnlyWhenFilesAreNotPresent(string projectid)
{
if (App.GotFiles(projectid))
{
App.Play(projectid, false, false, null);
}
else
{
App.Play(projectid, true, true, null);
}
}

§ Initialize()

static void Headjack.App.Initialize ( OnEnd  OnReady,
bool  autoCreateCamera = true,
bool  cardboardStereoMode = true 
)
inlinestatic

Initialize the app and download necessary data

Parameters
OnReadyWill be called when done
autoCreateCameraAlso activate the VR camera
cardboardStereoMode(cardboard) VR Mode enabled for cardboard
Note
Must be called before all other Headjack operations

Example

public void Initialize()
{
App.Initialize(OnReady);
}
public void OnReady(bool Succes)
{
if (Succes)
{
print("Initialized!");
}else
{
print("No internet connection");
}
}

§ IsCrosshairHit()

static bool Headjack.App.IsCrosshairHit ( GameObject  target,
out RaycastHit  hitInfo,
RaycastSource  raycastSource = RaycastSource.Gaze 
)
inlinestatic

Returns true if the user is looking at the target

Parameters
targetThe object to check
raycastSourceWhere the raycast is coming from
Returns
True if the user is looking at the object
Note
Object must have a collider (2d colliders won't work)

Example

bool IsTheCameraLookingAtMe
{
return App.IsCrosshairHit(gameobject);
}

§ Play()

static void Headjack.App.Play ( string  ProjectId,
bool  Stream,
bool  WifiOnly,
OnEnd  onEnd = null 
)
inlinestatic

Play a project

Parameters
ProjectIdThe project you want to play
StreamDirectly stream the video from the server
WifiOnly(Streaming) only stream when connected to a wifi network
onEndWill be called when the video is finished
Note
Will automatically create and initialize the video player. If stream is false, the video won't play if it isn't downloaded first
Warning
WifiOnly is strongly recommended when using Stream to avoid high mobile data costs

Example

public void StreamFirstVideo()
{
string id = App.GetProjects()[0];
App.Play(id, true, true, onEnd);
}
public void onEnd(bool succes, string error)
{
print("Video has finished playing!");
}

§ ProjectIsDownloading()

static bool Headjack.App.ProjectIsDownloading ( string  ProjectId)
inlinestatic

Check if a project is currently downloading

Parameters
ProjectIdProject to check
Returns
True if a project is currently downloading
Note
To get the progress, use App.GetProjectProgress

Example

public float GetProgress(string projectid)
{
if (App.ProjectIsDownloading(projectid))
{
return App.GetProjectProgress(projectid);
}
else
{
return -1;
}
}

§ ProjectIsLiveStream()

static bool Headjack.App.ProjectIsLiveStream ( string  ProjectId)
inlinestatic

Check if a project contains a live stream

Returns
true if the project contains a live stream

Example

public string IsLivestream(ProjectId)
{
if(App.ProjectIsLiveStream(ProjectId))
{
return "Livestream!";
}else{
return "No Livestream";
}
}

§ Recenter()

static void Headjack.App.Recenter ( )
inlinestatic

Recenter orientation and position on your device

Example

//Recenter when playing a video
void PlayVideo(string id)
{
App.Recenter();
App.Play(id, true, true, null);
}

§ SetCamera()

static void Headjack.App.SetCamera ( bool  visible = true,
bool  vrMode = true 
)
inlinestatic

Enable or Disable the VR Camera. Enable or Disable cardboard VR mode

Parameters
visibleEnable or Disable the VR Camera
vrMode(cardboard) Enable or Disable VR mode

Example

public void GoFullScreen()
{
App.SetCamera(true,false);
}

§ SetCameraBackground()

static void Headjack.App.SetCameraBackground ( Color  backgroundColor)
inlinestatic

Set background color

Parameters
backgroundColorUnityEngine.Color object containing new background color
Note
This sets the background color of the active VR camera, and persists between Unity scenes.

Example

// Set backgound color to red
public void SetRedBackground()
{
}

§ ShowMessage()

static void Headjack.App.ShowMessage ( string  Message,
float  TimeInSeconds = 3,
OnEnd  onEnd = null 
)
inlinestatic

PopUp Messages for displaying a text

Example

public void SayHello()
{
App.ShowMessage("Hello world", 1f);
}

§ UpdateAvailable()

static bool Headjack.App.UpdateAvailable ( string  Id)
inlinestatic

Check if a project or media file has an update available

Parameters
IdId to check
Returns
True if there is an update available
Note
Will also return True if the files are not yet downloaded!!

Example

public void CheckForUpdates()
{
string[] projects = App.GetProjects();
foreach (string project in projects)
{
if(App.UpdateAvailable(project))
{
print(project + " has an update available!");
}
}
}

Member Data Documentation

§ camera

new static Transform Headjack.App.camera
static

Camera information

§ CameraParent

GameObject Headjack.App.CameraParent
static

VR Camera GameObject

Returns
GameObject of the active VR Camera
Note
For Camera Position or Rotation, please use App.Camera. For Disabling or Enabling the Camera, please use App.SetCamera(bool, bool)

§ Crosshair

Crosshair Headjack.App.Crosshair
static

Crosshair

§ CrosshairHit

RaycastHit Headjack.App.CrosshairHit
static

All raycast information about what the user is looking at

Returns
RaycastHit information
Note
Use App.IsCrosshairHit to quickly check if an certain object is being looked at

Example

public float DistanceToObjectLookingAt
{
return App.CrosshairHit.distance;
}

§ CurrentProject

string Headjack.App.CurrentProject
static

The id of the project that is currently being played

Returns
The id of the project that is currently being played

§ CurrentVideo

string Headjack.App.CurrentVideo
static

The id of the video that is currently being played

Returns
The id of the video that is currently being played

§ LaserHit

RaycastHit Headjack.App.LaserHit
static

All raycast information about what the user is pointing at with the motion controller

Returns
RaycastHit information
Note
Use App.IsCrosshairHit to quickly check if an certain object is being aimed at

Example

public Vector3 AimingLocation
{
return App.LaserHit.point;
}

§ TouchHit

RaycastHit Headjack.App.TouchHit
static

All raycast information about what the user is touching on screen (Cardboard)

Returns
RaycastHit information
Note
Use App.IsCrosshairHit to quickly check if an certain object is being touched

Example

public GameObject ObjectTouching
{
return App.TouchHit.collider.gameObject;
}

Property Documentation

§ CameraScale

float Headjack.App.CameraScale
staticgetset

Changing the camera scale will Shrink or Enlarge the world around you. Usefull if an interface needs to get just a little bigger or smaller

Returns
Returns the current camera scale
Note
Will clamp between 0.1 and 100

Example

//Shrink or grow with the arrow keys
void Update()
{
if (Input.GetKeyDown(KeyCode.UpArrow))
{
App.CameraScale+=1;
}
if (Input.GetKeyDown(KeyCode.DownArrow))
{
App.CameraScale-=1;
}
}

§ CurrentPlatform

VRPlatform Headjack.App.CurrentPlatform
staticget

Checks the current platform

Returns
The current platform Headjack is running on
Note
For testing: You can change this in the Headjack settings window

Example

void LogCurrentPlatform
{
#if UNITY_ANDROID
if (App.CurrentPlatform == App.VRPlatform.Oculus)
{
Debug.Log("This app is running on GearVR");
}
if (App.CurrentPlatform == App.VRPlatform.Cardboard)
{
Debug.Log("This app is running on Android Cardboard");
}
#endif
#if UNITY_IOS
if (App.CurrentPlatform == App.VRPlatform.Cardboard)
{
Debug.Log("This app is running on Ios Cardboard");
}
#endif
#if UNITY_STANDALONE
if (App.CurrentPlatform == App.VRPlatform.Oculus)
{
Debug.Log("This app is running on Oculus Rift");
}
if (App.CurrentPlatform == App.VRPlatform.OpenVR)
{
Debug.Log("This app is running on HTC Vive");
}
#endif
}

§ EnableOVRPlatformMenu

bool Headjack.App.EnableOVRPlatformMenu
staticgetset

If true, the back button on the GearVR will open the Oculus Platform Menu. You can disable this when the user goes out of the menu and in a video.

Returns
If the platform menu is enabled
Note
GearVR only
Warning
If disabled, make sure that the back button will always bring you back to the "upper menu" where it is enabled. The user must always be able to reach the Oculus platform menu by keep pressing the back button.

Example

//Disable when playing a video
void PlayVideo(string id)
{
App.EnableOVRPlatformMenu=false;
App.Play(id, true, true, null);
}

§ IsPublished

bool Headjack.App.IsPublished
staticget

Returns whether app has published state set in Headjack

Returns
True if the app is set to published in Headjack (and is therefore available to use)
Warning
If an app is set to unpublished in Headjack, the app will receive no media information, like projects, videos or thumbnails.

Example

// Show message to the user when app is unpublished
public void MessageUserUnpublished()
{
{
Headjack.App.ShowMessage("This app is not published and is currently unavailable!", 5);
}
}

§ IsVRMode

bool Headjack.App.IsVRMode
staticget

Returns whether app is currently running in VR mode (e.g. stereo display), or not (e.g. fullscreen cardboard menu)

Returns
True if the app is currently running in VR mode

Example

// Show message to the user when not in VR mode
public void MessageUserNotVR()
{
{
Headjack.App.ShowMessage("You are currently not in VR mode", 5);
}
}

§ ShowCrosshair

bool Headjack.App.ShowCrosshair
staticgetset

Headjack's crosshair

Returns
True if the crosshair is currently visible

Example

public void HideCrosshair()
{
App.ShowCrosshair=false;
}

The documentation for this class was generated from the following file: