Breakroom is now Sinewave Campus. Book a meeting

SSphereCollider

ClientComponents
On this classCenter
  1. Properties
  2. Center
  3. Radius
  4. Enabled
  5. IsTrigger
  6. GameObject
Members 5
PropertyCenterThe center of the sphere in the object's local space.
PropertyRadiusThe radius of the sphere measured in the object's local space.
PropertyEnabledEnabled Colliders will collide with other Colliders, disabled Colliders won't.
PropertyIsTriggerIs the collider a trigger?
PropertyGameObject–

Properties​

Center​

SVector Center {get; set; }

The center of the sphere in the object's local space.

Example

Lua
Center = Space.Host.ExecutingObject.SphereCollider.Center
Lua
--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)

Radius​

float Radius {get; set; }

The radius of the sphere measured in the object's local space.

Example

Lua
Space.Host.ExecutingObject.SphereCollider.Radius = 2
Lua
--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)

Enabled​

bool Enabled {get; set; }

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

Example

Lua
Space.Host.ExecutingObject.SphereCollider.Enabled = false
Lua
--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)

IsTrigger​

bool IsTrigger {get; set; }

Is the collider a trigger?

Example

Lua
Space.Host.ExecutingObject.SphereCollider.Enabled = true
Lua
--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)

GameObjectRead only​

SGameObject GameObject {get; }

Example

Lua
theGameObject = Space.Host.ExecutingObject.SphereCollider.GameObject