wiki.sine.space | sinespace

Difference between revisions of "Scripting/SUIRaycastResult"

From wiki.sine.space
Jump to: navigation, search
Line 22: Line 22:
 
thisObject.OnUpdate(OnUpdate)</pre>}}
 
thisObject.OnUpdate(OnUpdate)</pre>}}
  
{{ScriptFunction|float|Distance|{ get; }|Returns the distance of the Raycast result|5=<pre>Result = Distance = Space.UI.Raycast().Distance</pre>|6=<pre></pre>}}
+
{{ScriptFunction|float|Distance|{ get; }|Returns the distance of the Raycast result|5=<pre>Result = Distance = Space.UI.Raycast().Distance</pre>|6=<pre>--This script will update a UIText element with the Distance of the 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
  
{{ScriptFunction|float|Index|{ get;}|Returns the Distance of the Raycast result|5=<pre>Index= Space.UI.Raycast().Index</pre>|6=<pre></pre>}}
 
  
{{ScriptFunction|int|Depth|{ get; }|Returns the Depth of the Raycast result|5=<pre>Depth= Space.UI.Raycast().Depth</pre>|6=<pre></pre>}}
+
OnUpdate = function()
 +
  if Space.Input.GetMouseDown(0) == true then
 +
  result = Space.UI.Raycast()
 +
    if result.IsValid then
 +
      uiText = result.Distance
 +
    end
 +
  end
 +
end
 +
 
 +
thisObject.OnUpdate(OnUpdate)</pre>}}
 +
 
 +
{{ScriptFunction|float|Index|{ get;}|Returns the Index of the Raycast result|5=<pre>Index= Space.UI.Raycast().Index</pre>|6=<pre>--This script will update a UIText element with the Index of the 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.Index
 +
    end
 +
  end
 +
end
 +
 
 +
thisObject.OnUpdate(OnUpdate)
 +
</pre>}}
 +
 
 +
{{ScriptFunction|int|Depth|{ get; }|Returns the Depth of the Raycast result|5=<pre>Depth= Space.UI.Raycast().Depth</pre>|6=<pre>--This script will update a UIText element with the Depth of the 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.Depth
 +
    end
 +
  end
 +
end
 +
 
 +
thisObject.OnUpdate(OnUpdate)</pre>}}
  
 
{{ScriptFunction|int|SortingLayer|{ get; }|Returns the Sorting Layer of the Raycast result|5=<pre>SortingLayer= Space.UI.Raycast().SortingLayer</pre>|6=<pre></pre>}}
 
{{ScriptFunction|int|SortingLayer|{ get; }|Returns the Sorting Layer of the Raycast result|5=<pre>SortingLayer= Space.UI.Raycast().SortingLayer</pre>|6=<pre></pre>}}
Line 47: Line 93:
 
thisObject.OnUpdate(OnUpdate)</pre>}}
 
thisObject.OnUpdate(OnUpdate)</pre>}}
  
{{ScriptFunction|SVector|WorldPosition|{ get;}|Returns the World Position vector of the Raycast result|5=<pre>WorldPosition= Space.UI.Raycast().WorldPosition</pre>|6=<pre></pre>}}
+
{{ScriptFunction|SVector|WorldPosition|{ get;}|Returns the World Position vector of the Raycast result|5=<pre>WorldPosition= Space.UI.Raycast().WorldPosition</pre>|6=<pre>--This script will update a UIText element with the World Position of the 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
  
{{ScriptFunction|SVector|WorldNormal|{ get; }|Returns the World Normal vector of the Raycast result|5=<pre>WorldNormal= Space.UI.Raycast().WorldNormal</pre>|6=<pre></pre>}}
+
 
 +
OnUpdate = function()
 +
  if Space.Input.GetMouseDown(0) == true then
 +
  result = Space.UI.Raycast()
 +
    if result.IsValid then
 +
      uiText = result.WorldPosition
 +
    end
 +
  end
 +
end
 +
 
 +
thisObject.OnUpdate(OnUpdate)</pre>}}
 +
 
 +
{{ScriptFunction|SVector|WorldNormal|{ get; }|Returns the World Normal vector of the Raycast result|5=<pre>WorldNormal= Space.UI.Raycast().WorldNormal</pre>|6=<pre>--This script will update a UIText element with the World Normal of the 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.WorldNormal
 +
    end
 +
  end
 +
end
 +
 
 +
thisObject.OnUpdate(OnUpdate)</pre>}}
  
 
{{ScriptFunction|SVector|ScreenPosition|{ get; }|Returns the Screen Position vector of the Raycast result|5=<pre>ScreenPosition= Space.UI.Raycast().ScreenPosition</pre>|6=<pre>--This script will update a UIText element with the Screen Position of the UIRaycast whenever
 
{{ScriptFunction|SVector|ScreenPosition|{ get; }|Returns the Screen Position vector of the Raycast result|5=<pre>ScreenPosition= Space.UI.Raycast().ScreenPosition</pre>|6=<pre>--This script will update a UIText element with the Screen Position of the UIRaycast whenever

Revision as of 16:19, 8 January 2022

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


--This script will update a UIText element with the Distance of the 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.Distance
    end
  end
end

thisObject.OnUpdate(OnUpdate)

Index

float Index { get;}

Returns the Index of the Raycast result

Index= Space.UI.Raycast().Index


--This script will update a UIText element with the Index of the 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.Index
    end
  end
end

thisObject.OnUpdate(OnUpdate)

Depth

int Depth { get; }

Returns the Depth of the Raycast result

Depth= Space.UI.Raycast().Depth


--This script will update a UIText element with the Depth of the 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.Depth
    end
  end
end

thisObject.OnUpdate(OnUpdate)

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


--This script will update a UIText element with the Sorting Order of the 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.SortingOrder
    end
  end
end

thisObject.OnUpdate(OnUpdate)

WorldPosition

SVector WorldPosition { get;}

Returns the World Position vector of the Raycast result

WorldPosition= Space.UI.Raycast().WorldPosition


--This script will update a UIText element with the World Position of the 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.WorldPosition
    end
  end
end

thisObject.OnUpdate(OnUpdate)

WorldNormal

SVector WorldNormal { get; }

Returns the World Normal vector of the Raycast result

WorldNormal= Space.UI.Raycast().WorldNormal


--This script will update a UIText element with the World Normal of the 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.WorldNormal
    end
  end
end

thisObject.OnUpdate(OnUpdate)

ScreenPosition

SVector ScreenPosition { get; }

Returns the Screen Position vector of the Raycast result

ScreenPosition= Space.UI.Raycast().ScreenPosition


--This script will update a UIText element with the Screen Position of the 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.ScreenPosition
    end
  end
end

thisObject.OnUpdate(OnUpdate)

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


--This script will check if Raycast result is valid
--and 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)