wiki.sine.space | sinespace

Scripting/SUIRaycastResult

From wiki.sine.space
Revision as of 17:57, 7 January 2022 by Voidtech (Talk | contribs)

Jump to: navigation, search

Clear

void Clear ();

Definition


ToString

string ToString ();

Converts all the properties of this UIRaycastResult into a string

Result = Space.UI.Raycast().ToString()


--This script will update a UIText element with the result of a UIRaycast whenever...
--the player clicks on a Sinespace UI element
thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting Runtime



OnUpdate = function()

  if Space.Input.GetMouseDown(0) == true then
  result = Space.UI.Raycast()	
    if result.IsValid then 
      uiText = result.ToString()
    end
  end
end


thisObject.OnUpdate(OnUpdate)

Distance

float Distance { get; }

Returns the distance of the Raycast result

Result = Distance = Space.UI.Raycast().Distance


Index

float Index { get;}

Returns the Distance of the Raycast result

Index= Space.UI.Raycast().Index


Depth

int Depth { get; }

Returns the Depth of the Raycast result

Depth= Space.UI.Raycast().Depth


SortingLayer

int SortingLayer { get; }

Returns the Sorting Layer of the Raycast result

SortingLayer= Space.UI.Raycast().SortingLayer


SortingOrder

int SortingOrder { get; }

Returns the Sorting Order of the Raycast result

SortingOrder= Space.UI.Raycast().SortingOrder


WorldPosition

SVector WorldPosition { get;}

Returns the World Position vector of the Raycast result

WorldPosition= Space.UI.Raycast().WorldPosition


WorldNormal

SVector WorldNormal { get; }

Returns the World Normal vector of the Raycast result

WorldNormal= Space.UI.Raycast().WorldNormal


ScreenPosition

SVector ScreenPosition { get; }

Returns the Screen Position vector of the Raycast result

ScreenPosition= Space.UI.Raycast().ScreenPosition


GameObject

SGameObject GameObject { get; }

Returns a reference to the GameObject of the Raycast result

GameObject= Space.UI.Raycast().GameObject


IsValid

bool IsValid { get; }

Returns whether the Raycast hit a valid UI Raycast target. This will be true if the Raycast hits an element on Sinespace's UI

IsValid= Space.UI.Raycast().IsValid