# SCapsuleCollider

## Index

### Properties Index

| Property Name                                |
| -------------------------------------------- |
| SVector [**Center** ](#center)`get` `set`    |
| int [**Direction** ](#direction)`get` `set`  |
| float [**Height** ](#height)`get` `set`      |
| float [**Radius** ](#radius)`get` `set`      |
| bool [**Enabled** ](#enabled)`get` `set`     |
| bool [**IsTrigger** ](#istrigger)`get` `set` |

## Properties

### Center

[SVector](https://docs.sine.space/scripting/client-scripting-api-reference/types/svector) **Center** `get` `set`

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

{% tabs %}
{% tab title="Lua" %}

```lua
Center = Space.Host.ExecutingObject.CapsuleCollider.Center
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Lua" %}

```lua
--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)
```

{% endtab %}
{% endtabs %}

### Direction

int **Direction** `get` `set`

*The direction of the capsule.*

{% tabs %}
{% tab title="Lua" %}

```lua
 Direction = Space.Host.ExecutingObject.CapsuleCollider.Direction 
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Lua" %}

```lua
--clicking this object increases it's Capsule Collider's direction by one unit

thisObject = Space.Host.ExecutingObject

OnClick = function()
thisObject.CapsuleCollider.Direction

thisObject.CapsuleCollider.Direction = thisObject.CapsuleCollider.Direction + 1

end

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

{% endtab %}
{% endtabs %}

### Height

float **Height** `get set`

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

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.CapsuleCollider.Height = 5.0
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Lua" %}

```lua
--clicking this object increases it's Capsule Collider's height by one unit

thisObject = Space.Host.ExecutingObject

OnClick = function()
thisObject.CapsuleCollider.Height

thisObject.CapsuleCollider.Height= thisObject.CapsuleCollider.Height+ 1.0

end

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

{% endtab %}
{% endtabs %}

### Radius

float **Radius** `get` `set`

*The radius of the capsule.*

{% tabs %}
{% tab title="Lua" %}

```lua
Radius = Space.Host.ExecutingObject.CapsuleCollider.Radius
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Lua" %}

```lua
--clicking this object increments it's Capsule Collider's radius by one unit 

thisObject = Space.Host.ExecutingObject

OnClick = function()
thisObject.CapsuleCollider.Radius = thisObject.CapsuleCollider.Radius + 1

end

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

{% endtab %}
{% endtabs %}

### Enabled

bool **Enabled** `get` `set`

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

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.CapsuleCollider.Enabled = false
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Lua" %}

```lua
--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)
```

{% endtab %}
{% endtabs %}

### IsTrigger

bool **IsTrigger** `get` `set`

*Is the collider a trigger?*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.CapsuleCollider.IsTrigger = false
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Lua" %}

```lua
--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)
```

{% endtab %}
{% endtabs %}

### GameObject

[SGameObject](https://docs.sine.space/scripting/client-scripting-api-reference/types/sgameobject) **GameObject** `get`

*Returns a reference to the GameObject of this component.*

{% tabs %}
{% tab title="Lua" %}

```lua
theGameObject = Space.Host.ExecutingObject.CapsuleCollider.GameObject
```

{% endtab %}
{% endtabs %}
