Class CapsuleColliderCast
ColliderCast behaviour intended to work with any capsule collider shape.
Inherited Members
Namespace: nickmaltbie.OpenKCC.Utils.ColliderCast
Assembly: cs.temp.dll.dll
Syntax
public class CapsuleColliderCast : AbstractPrimitiveColliderCast, IColliderCast, IRaycastHelper
Fields
center
Center of the capsule.
Declaration
public Vector3 center
Field Value
Type | Description |
---|---|
Vector3 |
height
Height of the capsule.
Declaration
public float height
Field Value
Type | Description |
---|---|
Single |
radius
Radius of the capsule.
Declaration
public float radius
Field Value
Type | Description |
---|---|
Single |
Properties
DebugCapsuleMesh
Debug mesh associated with capsule collider.
Declaration
public Mesh DebugCapsuleMesh { get; }
Property Value
Type | Description |
---|---|
Mesh |
Methods
GetBottom(Vector3, Quaternion)
Gets the bottom of the bounds of the collider.
Declaration
public override Vector3 GetBottom(Vector3 position, Quaternion rotation)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | position | Position of the object when it is being checked. |
Quaternion | rotation | Rotation of the objecting when it is being checked. |
Returns
Type | Description |
---|---|
Vector3 | Bottom of the bounds of the collider. |
Overrides
GetCapsuleRelativeUp(CapsuleDirection)
Get relative up direction for the capsule based on capsule direction.
Declaration
public static Vector3 GetCapsuleRelativeUp(CapsuleDirection capsuleDirection)
Parameters
Type | Name | Description |
---|---|---|
CapsuleDirection | capsuleDirection |
Returns
Type | Description |
---|---|
Vector3 |
GetHits(Vector3, Quaternion, Vector3, Single, Int32, QueryTriggerInteraction, Single)
Cast self and get the objects hit that exclude this object.
Declaration
public override IEnumerable<RaycastHit> GetHits(Vector3 position, Quaternion rotation, Vector3 direction, float distance, int layerMask = -1, QueryTriggerInteraction queryTriggerInteraction = null, float skinWidth = 0.01F)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | position | Position of the object when it is being raycast. |
Quaternion | rotation | Rotation of the objecting when it is being raycast. |
Vector3 | direction | Direction to cast self collider. |
Single | distance | Distance to cast self collider. |
Int32 | layerMask | Layer mask for checking which objects to collide with. |
QueryTriggerInteraction | queryTriggerInteraction | Configuration for QueryTriggerInteraction when solving for collisions. |
Single | skinWidth | Buffer around player when computing collisions. |
Returns
Type | Description |
---|---|
IEnumerable<RaycastHit> | List of objects this hits when it is being raycast |
Overrides
GetOverlapping(Vector3, Quaternion, Int32, QueryTriggerInteraction, Single)
Gets the list of objects overlapping with this object.
Declaration
public override IEnumerable<Collider> GetOverlapping(Vector3 position, Quaternion rotation, int layerMask = -1, QueryTriggerInteraction queryTriggerInteraction = null, float skinWidth = 0F)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | position | Position of the object when it is being checked. |
Quaternion | rotation | Rotation of the objecting when it is being checked. |
Int32 | layerMask | Layer mask for checking which objects to collide with. |
QueryTriggerInteraction | queryTriggerInteraction | Configuration for QueryTriggerInteraction when solving for collisions. |
Single | skinWidth | Buffer around player when computing overlapping objects. |
Returns
Type | Description |
---|---|
IEnumerable<Collider> | The list of overlapping objects with this object. |
Overrides
GetParams(Vector3, Quaternion, Single)
Gets transformed parameters describing this capsule collider for a given position and rotation
Declaration
public (Vector3, Vector3, float, float) GetParams(Vector3 position, Quaternion rotation, float radiusMod = 0F)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | position | Position of the object. |
Quaternion | rotation | Rotation of the object. |
Single | radiusMod | Modifier to add to radius when computing shape of collider. |
Returns
Type | Description |
---|---|
(T1 Item1, T2 Item2, T3 Item3, T4 Item4)<Vector3, Vector3, Single, Single> | The top, bottom, radius, and height of the capsule collider |
GetParams(Vector3, Single, Single, CapsuleDirection, Vector3, Quaternion, Single)
Gets transformed parameters describing this capsule collider for a given position and rotation
Declaration
public static (Vector3, Vector3, float, float) GetParams(Vector3 capsuleCenter, float capsuleRadius, float capsuleHeight, CapsuleDirection capsuleDirection, Vector3 position, Quaternion rotation, float radiusMod = 0F)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | capsuleCenter | Center of the capsule collider in relative position. |
Single | capsuleRadius | Radius of the capsule |
Single | capsuleHeight | Height of the capsule. |
CapsuleDirection | capsuleDirection | Direction of the capsule. |
Vector3 | position | Position of the object. |
Quaternion | rotation | Rotation of the object. |
Single | radiusMod | Modifier to add to radius when computing shape of collider. |
Returns
Type | Description |
---|---|
(T1 Item1, T2 Item2, T3 Item3, T4 Item4)<Vector3, Vector3, Single, Single> | The top, bottom, radius, and height of the capsule collider |
SetupColliderComponent()
Setup the collider component associated with this object.
Declaration
protected override Collider SetupColliderComponent()
Returns
Type | Description |
---|---|
Collider | Collider created (or one that already exists) for this object. |
Overrides
UpdateColliderParameters()
Update the parameters of the collider on a configuration change.
Declaration
public override void UpdateColliderParameters()