Class ColliderConfiguration
Generic collider configuration.
Namespace: nickmaltbie.OpenKCC.Utils.ColliderCast
Assembly: cs.temp.dll.dll
Syntax
public class ColliderConfiguration : PropertyAttribute
Constructors
ColliderConfiguration(ColliderType, Nullable<Vector3>, Nullable<Vector3>, Single, Single, CapsuleDirection)
Constructs an instance of Collider configuration.
Declaration
public ColliderConfiguration(ColliderType type = ColliderType.Box, Vector3? center = null, Vector3? size = null, float radius = 0.5F, float height = 2F, CapsuleDirection capsuleDirection = CapsuleDirection.Y)
Parameters
Type | Name | Description |
---|---|---|
ColliderType | type | Type of collider to create. |
Nullable<Vector3> | center | Center of the collider in 3D space. |
Nullable<Vector3> | size | Size of the collider (only applies to Box) |
Single | radius | Radius fo the collider (applies to Sphere or Capsule). |
Single | height | Height of the collider (applies to Capsule). |
CapsuleDirection | capsuleDirection | Direction of capsule collider. |
Fields
boxCenter
Center of box collider.
Declaration
public Vector3 boxCenter
Field Value
Type | Description |
---|---|
Vector3 |
boxSize
Size of the box collider.
Declaration
public Vector3 boxSize
Field Value
Type | Description |
---|---|
Vector3 |
capsuleCenter
Center of capsule collider
Declaration
public Vector3 capsuleCenter
Field Value
Type | Description |
---|---|
Vector3 |
capsuleDirection
Direction fo the capsule collider.
Declaration
public CapsuleDirection capsuleDirection
Field Value
Type | Description |
---|---|
CapsuleDirection |
capsuleHeight
Height of the capsule collider.
Declaration
public float capsuleHeight
Field Value
Type | Description |
---|---|
Single |
capsuleRadius
Radius of the capsule collider.
Declaration
public float capsuleRadius
Field Value
Type | Description |
---|---|
Single |
pointCenter
Center of point collider.
Declaration
public Vector3 pointCenter
Field Value
Type | Description |
---|---|
Vector3 |
sphereCenter
Center of sphere collider.
Declaration
public Vector3 sphereCenter
Field Value
Type | Description |
---|---|
Vector3 |
sphereRadius
Radius of the sphere collider.
Declaration
public float sphereRadius
Field Value
Type | Description |
---|---|
Single |
type
Type of collider for this configuration.
Declaration
public ColliderType type
Field Value
Type | Description |
---|---|
ColliderType |
Properties
CapsuleDirection
Gets or Sets Direction of capsule collider.
Declaration
public CapsuleDirection CapsuleDirection { get; set; }
Property Value
Type | Description |
---|---|
CapsuleDirection |
Center
Gets or sets the center of the collider (applies to Box, Sphere, or Capsule).
Declaration
public Vector3 Center { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
Height
Gets or sets the height of the collider (applies to Capsule).
Declaration
public float Height { get; set; }
Property Value
Type | Description |
---|---|
Single |
Radius
Gets or sets the radius fo the collider (applies to Sphere or Capsule).
Declaration
public float Radius { get; set; }
Property Value
Type | Description |
---|---|
Single |
Size
Gets or sets the size of the collider (applies to Box).
Declaration
public Vector3 Size { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
Methods
AttachCollider(GameObject, Boolean)
Attaches a collider component to a given game object based on this collider configuration.
Declaration
public Collider AttachCollider(GameObject go, bool cleanupCollider = true)
Parameters
Type | Name | Description |
---|---|---|
GameObject | go | Game object to attach collider to. |
Boolean | cleanupCollider | Should existing colliders on the object be cleaned up. |
Returns
Type | Description |
---|---|
Collider | Collider attached to the given game object. |