wiki.sine.space | sinespace

Difference between revisions of "Scripting/SCapsuleCollider"

From wiki.sine.space
Jump to: navigation, search
Line 1: Line 1:
 
==Properties==
 
==Properties==
  
{{ScriptFunction|SVector|Center|[get, set]|The center of the capsule, measured in the object's local space.|5=<pre>Center = Space.Host.ExecutingObject.CapsuleCollider.Center</pre>|6=<pre></pre>}}
+
{{ScriptFunction|SVector|Center|[get, set]|The center of the capsule, measured in the object's local space.|5=<pre>Center = Space.Host.ExecutingObject.CapsuleCollider.Center</pre>|6=<pre>--clicking this object moves it's Capsule Collider's center one unit upwards
 +
 
 +
thisObject = Space.Host.ExecutingObject
 +
 
 +
OnClick = function()
 +
center = thisObject.CapsuleCollider.Center
 +
 
 +
thisObject.CapsuleCollider.Center = Vector.New(center.X,center.Y + 1, center.Z)
 +
 
 +
end
 +
 
 +
thisObject.AddClickable()
 +
thisObject.Clickable.OnClick(OnClick)</pre>}}
  
 
{{ScriptFunction|int|Direction|[get, set]|The direction of the capsule.|5=<pre> Direction = Space.Host.ExecutingObject.CapsuleCollider.Direction </pre>|6=<pre></pre>}}
 
{{ScriptFunction|int|Direction|[get, set]|The direction of the capsule.|5=<pre> Direction = Space.Host.ExecutingObject.CapsuleCollider.Direction </pre>|6=<pre></pre>}}

Revision as of 16:44, 20 January 2022

Properties

Center

SVector Center [get, set]

The center of the capsule, measured in the object's local space.

Center = Space.Host.ExecutingObject.CapsuleCollider.Center


--clicking this object moves it's Capsule Collider's center one unit upwards

thisObject = Space.Host.ExecutingObject

OnClick = function()
center = thisObject.CapsuleCollider.Center

thisObject.CapsuleCollider.Center = Vector.New(center.X,center.Y + 1, center.Z)

end

thisObject.AddClickable() 
thisObject.Clickable.OnClick(OnClick)

Direction

int Direction [get, set]

The direction of the capsule.

 Direction = Space.Host.ExecutingObject.CapsuleCollider.Direction 


Height

float Height [get, set]

The height of the capsule measured in the object's local space.

Height= Space.Host.ExecutingObject.CapsuleCollider.Height


Radius

int Radius [get, set]

The radius of the capsule.

Radius = Space.Host.ExecutingObject.CapsuleCollider.Radius


Enabled

bool Enabled [get, set]

Enabled Colliders will collide with other Colliders, disabled Colliders won't.

Space.Host.ExecutingObject.CapsuleCollider.Enabled = false


--clicking this object toggles it's Capsule Collider On/Off

thisObject = Space.Host.ExecutingObject

OnClick = function()
thisObject.CapsuleCollider.Enabled = not thisObject.CapsuleCollider.Enabled

end

thisObject.AddClickable() 
thisObject.Clickable.OnClick(OnClick)


IsTrigger

bool IsTrigger [get, set]

Is the collider a trigger?

Space.Host.ExecutingObject.CapsuleCollider.IsTrigger = false


--clicking this object toggles it's Capsule Collider between being a Collider vs Trigger Collider

thisObject = Space.Host.ExecutingObject

OnClick = function()
thisObject.CapsuleCollider.IsTrigger = not thisObject.CapsuleCollider.IsTrigger

end

thisObject.AddClickable() 
thisObject.Clickable.OnClick(OnClick)