Breakroom is now Sinewave Campus. Book a meeting

SSphereCollider

العميلالمكونات
في هذا الصنفCenter
  1. الخصائص
  2. Center
  3. Radius
  4. Enabled
  5. IsTrigger
  6. GameObject
الأعضاء 5
خاصيةCenterThe center of the sphere in the object's local space.
خاصيةRadiusThe radius of the sphere measured in the object's local space.
خاصيةEnabledEnabled Colliders will collide with other Colliders, disabled Colliders won't.
خاصيةIsTriggerIs the collider a trigger?
خاصيةGameObject–

الخصائص​

Center​

SVector Center {get; set; }

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

مثال

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.

مثال

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.

مثال

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?

مثال

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)

GameObjectللقراءة فقط​

SGameObject GameObject {get; }

مثال

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