Class SphereColliderCast
ColliderCast behaviour intended to work with any sphere collider shape.
Inherited Members
Namespace: nickmaltbie.OpenKCC.Utils.ColliderCast
Assembly: cs.temp.dll.dll
Syntax
public class SphereColliderCast : AbstractPrimitiveColliderCast, IColliderCast, IRaycastHelper
Fields
center
Center of the sphere.
Declaration
public Vector3 center
Field Value
Type | Description |
---|---|
Vector3 |
radius
Radius of the sphere.
Declaration
public float radius
Field Value
Type | Description |
---|---|
Single |
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
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 sphere collider for a given position and rotation
Declaration
public (Vector3, 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)<Vector3, Single> | Returns the center of the collider in world space and the modified radius. |
GetParams(Vector3, Single, Vector3, Quaternion, Single)
Gets transformed parameters describing this sphere collider for a given position and rotation
Declaration
public static (Vector3, float) GetParams(Vector3 sphereCenter, float sphereRadius, Vector3 position, Quaternion rotation, float radiusMod = 0F)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | sphereCenter | Relative position of sphere center. |
Single | sphereRadius | Radius of the sphere. |
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)<Vector3, Single> | Returns the center of the sphere in world space and the modified radius. |
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()