wiki.sine.space | sinespace

Difference between revisions of "Scripting/SSphereCollider"

From wiki.sine.space
Jump to: navigation, search
(Replaced content with "This page has moved to: https://docs.sine.space/v/scripting/client-scripting/components/sspherecollider")
 
Line 1: Line 1:
==Properties==
+
This page has moved to: https://docs.sine.space/v/scripting/client-scripting/components/sspherecollider
 
+
{{ScriptFunction|SVector|Center|[get, set]|The center of the sphere in the object's local space.|5=<pre>Center = Space.Host.ExecutingObject.SphereCollider.Center</pre>|6=<pre>--clicking this object moves it's Sphere Collider's center one unit upwards
+
 
+
thisObject = Space.Host.ExecutingObject
+
 
+
OnClick = function()
+
center = thisObject.SphereCollider.Center
+
 
+
thisObject.SphereCollider.Center = Vector.New(center.X,center.Y + 1, center.Z)
+
 
+
end
+
 
+
thisObject.AddClickable()
+
thisObject.Clickable.OnClick(OnClick)</pre>}}
+
 
+
{{ScriptFunction|float|Radius|[get, set]|The radius of the sphere measured in the object's local space.|5=<pre>Space.Host.ExecutingObject.SphereCollider.Radius = 2</pre>|6=<pre>--clicking this object increments it's Sphere Collider's radius by one unit
+
 
+
thisObject = Space.Host.ExecutingObject
+
 
+
OnClick = function()
+
 
+
thisObject.SphereCollider.Radius = thisObject.SphereCollider.Radius + 1
+
 
+
end
+
 
+
thisObject.AddClickable()
+
thisObject.Clickable.OnClick(OnClick)</pre>}}
+
 
+
{{ScriptFunction|bool|Enabled|[get, set]|Enabled Colliders will collide with other Colliders, disabled Colliders won't.|5=<pre>Space.Host.ExecutingObject.SphereCollider.Enabled = false</pre>|6=<pre>--clicking this object toggles it's Sphere Collider On/Off
+
 
+
thisObject = Space.Host.ExecutingObject
+
 
+
OnClick = function()
+
thisObject.SphereCollider.Enabled = not thisObject.SphereCollider.Enabled
+
 
+
end
+
 
+
thisObject.AddClickable()
+
thisObject.Clickable.OnClick(OnClick)</pre>}}
+
 
+
{{ScriptFunction|bool|IsTrigger|[get, set]|Is the collider a trigger?|5=<pre>Space.Host.ExecutingObject.SphereCollider.Enabled = true</pre>|6=<pre>--clicking this object toggles it's Sphere Collider between being a Collider vs Trigger Collider
+
 
+
thisObject = Space.Host.ExecutingObject
+
 
+
OnClick = function()
+
thisObject.SphereCollider.IsTrigger = not thisObject.SphereCollider.IsTrigger
+
 
+
end
+
 
+
thisObject.AddClickable()
+
thisObject.Clickable.OnClick(OnClick)</pre>}}
+
 
+
{{Scripting Navbox}}
+

Latest revision as of 06:26, 19 September 2022

This page has moved to: https://docs.sine.space/v/scripting/client-scripting/components/sspherecollider