Breakroom is now Sinewave Campus. Book a meeting

SSphereCollider

ClientComposants
Dans cette classeCenter
  1. Propriétés
  2. Center
  3. Radius
  4. Enabled
  5. IsTrigger
  6. GameObject
Membres 5
PropriétéCenterThe center of the sphere in the object's local space.
PropriétéRadiusThe radius of the sphere measured in the object's local space.
PropriétéEnabledEnabled Colliders will collide with other Colliders, disabled Colliders won't.
PropriétéIsTriggerIs the collider a trigger?
PropriétéGameObject–

Propriétés​

Center​

SVector Center {get; set; }

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

Exemple

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.

Exemple

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.

Exemple

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?

Exemple

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)

GameObjectLecture seule​

SGameObject GameObject {get; }

Exemple

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