Raycast Gizmos visualizer  1.0
Kit.Physic.CapsuleCastData Struct Reference

Structure wrapper for Capsulecast More...

Inheritance diagram for Kit.Physic.CapsuleCastData:
Kit.Physic.IRayStruct Kit.Physic.IRayAllStruct Kit.Physic.IRayStructBase Kit.Physic.IRayStructBase

Public Member Functions

 CapsuleCastData (Vector3 _point1, Vector3 _point2, float _radius, Vector3 _direction, float _maxDistance)
 Casts a capsule against all colliders in the scene and returns detailed information on what was hit. The capsule is defined by the two spheres with radius around point1 and point2, which form the two ends of the capsule.Hits are returned for the first collider which would collide against this capsule if the capsule was moved along direction. This is useful when a Raycast does not give enough precision, because you want to find out if an object of a specific size, such as a character, will be able to move somewhere without colliding with anything on the way. Notes: CapsuleCast will not detect colliders for which the capsule overlaps the collider. More...
 
bool CapsuleCast (Vector3 _point1, Vector3 _point2, float _radius, Vector3 _direction, float _maxDistance, int layerMask=Physics.DefaultRaycastLayers, QueryTriggerInteraction queryTriggerInteraction=QueryTriggerInteraction.UseGlobal)
 Casts a capsule against all colliders in the scene and returns detailed information on what was hit. The capsule is defined by the two spheres with radius around point1 and point2, which form the two ends of the capsule.Hits are returned for the first collider which would collide against this capsule if the capsule was moved along direction. This is useful when a Raycast does not give enough precision, because you want to find out if an object of a specific size, such as a character, will be able to move somewhere without colliding with anything on the way. Notes: CapsuleCast will not detect colliders for which the capsule overlaps the collider. More...
 
bool CapsuleCast (int layerMask=Physics.DefaultRaycastLayers, QueryTriggerInteraction queryTriggerInteraction=QueryTriggerInteraction.UseGlobal)
 Casts a capsule against all colliders in the scene and returns detailed information on what was hit. The capsule is defined by the two spheres with radius around point1 and point2, which form the two ends of the capsule.Hits are returned for the first collider which would collide against this capsule if the capsule was moved along direction. This is useful when a Raycast does not give enough precision, because you want to find out if an object of a specific size, such as a character, will be able to move somewhere without colliding with anything on the way. Notes: CapsuleCast will not detect colliders for which the capsule overlaps the collider. More...
 
int CapsuleCastNonAlloc (Vector3 _point1, Vector3 _point2, float _radius, Vector3 _direction, RaycastHit[] hits, float _maxDistance=Mathf.Infinity, int layerMask=Physics.DefaultRaycastLayers, QueryTriggerInteraction queryTriggerInteraction=QueryTriggerInteraction.UseGlobal)
 Casts a capsule against all colliders in the scene and returns detailed information on what was hit into the buffer. Like Physics.CapsuleCastAll, but generates no garbage. More...
 
int CapsuleCastNonAlloc (RaycastHit[] hits, int layerMask=Physics.DefaultRaycastLayers, QueryTriggerInteraction queryTriggerInteraction=QueryTriggerInteraction.UseGlobal)
 
void DrawGizmos (Color color, Color hitColor)
 Provide vizualize information (Gizmos) More...
 
void DrawAllGizmos (ref RaycastHit[] raycastHits, int validArraySize, Color color=default(Color), Color hitColor=default(Color))
 Provide vizualize information (Gizmos) More...
 
void Update (Vector3 _point1, Vector3 _point2, float _radius, Vector3 _direction, float _maxDistance)
 Update parameters More...
 
void Reset ()
 Reset parameters More...
 
override string ToString ()
 Provide vizualize information (Gizmos) More...
 
Vector3 [] GetEndPoints (float _distance)
 Get hit end point or point on max distance. More...
 

Public Attributes

Vector3 point1
 The center of the sphere at the start of the capsule. More...
 
Vector3 point2
 The center of the sphere at the end of the capsule. More...
 
float radius
 The radius of the capsule. More...
 
Vector3 direction
 The direction into which to sweep the capsule. More...
 
float maxDistance
 The max length of the sweep. More...
 

Properties

static CapsuleCastData NONE [get]
 
RaycastHit hitResult [get, set]
 hit result cached from last physics check. More...
 
bool hitted [get]
 bool, True if last physics result are hit. More...
 
int hitCount [get]
 hit count from last physics check. More...
 

Detailed Description

Structure wrapper for Capsulecast

Constructor & Destructor Documentation

◆ CapsuleCastData()

Kit.Physic.CapsuleCastData.CapsuleCastData ( Vector3  _point1,
Vector3  _point2,
float  _radius,
Vector3  _direction,
float  _maxDistance 
)

Casts a capsule against all colliders in the scene and returns detailed information on what was hit. The capsule is defined by the two spheres with radius around point1 and point2, which form the two ends of the capsule.Hits are returned for the first collider which would collide against this capsule if the capsule was moved along direction. This is useful when a Raycast does not give enough precision, because you want to find out if an object of a specific size, such as a character, will be able to move somewhere without colliding with anything on the way. Notes: CapsuleCast will not detect colliders for which the capsule overlaps the collider.

Parameters
_point1The center of the sphere at the start of the capsule.
_point2The center of the sphere at the end of the capsule.
_radiusThe radius of the capsule.
_directionThe direction into which to sweep the capsule.
_maxDistanceThe max length of the sweep.
See also
https://docs.unity3d.com/ScriptReference/Physics.CapsuleCast.html

Member Function Documentation

◆ CapsuleCast() [1/2]

bool Kit.Physic.CapsuleCastData.CapsuleCast ( Vector3  _point1,
Vector3  _point2,
float  _radius,
Vector3  _direction,
float  _maxDistance,
int  layerMask = Physics.DefaultRaycastLayers,
QueryTriggerInteraction  queryTriggerInteraction = QueryTriggerInteraction.UseGlobal 
)

Casts a capsule against all colliders in the scene and returns detailed information on what was hit. The capsule is defined by the two spheres with radius around point1 and point2, which form the two ends of the capsule.Hits are returned for the first collider which would collide against this capsule if the capsule was moved along direction. This is useful when a Raycast does not give enough precision, because you want to find out if an object of a specific size, such as a character, will be able to move somewhere without colliding with anything on the way. Notes: CapsuleCast will not detect colliders for which the capsule overlaps the collider.

Parameters
_point1The center of the sphere at the start of the capsule.
_point2The center of the sphere at the end of the capsule.
_radiusThe radius of the capsule.
_directionThe direction into which to sweep the capsule.
_maxDistanceThe max length of the sweep.
layerMaskA Layer mask that is used to selectively ignore colliders when casting a capsule.
queryTriggerInteractionSpecifies whether this query should hit Triggers.
Returns
bool True when the capsule sweep intersects any collider, otherwise false.
See also
https://docs.unity3d.com/ScriptReference/Physics.CapsuleCast.html

Referenced by Kit.Physic.RaycastHelper.GetCurrentStruct().

◆ CapsuleCast() [2/2]

bool Kit.Physic.CapsuleCastData.CapsuleCast ( int  layerMask = Physics.DefaultRaycastLayers,
QueryTriggerInteraction  queryTriggerInteraction = QueryTriggerInteraction.UseGlobal 
)

Casts a capsule against all colliders in the scene and returns detailed information on what was hit. The capsule is defined by the two spheres with radius around point1 and point2, which form the two ends of the capsule.Hits are returned for the first collider which would collide against this capsule if the capsule was moved along direction. This is useful when a Raycast does not give enough precision, because you want to find out if an object of a specific size, such as a character, will be able to move somewhere without colliding with anything on the way. Notes: CapsuleCast will not detect colliders for which the capsule overlaps the collider.

Parameters
layerMaskA Layer mask that is used to selectively ignore colliders when casting a capsule.
queryTriggerInteractionSpecifies whether this query should hit Triggers.
Returns
bool True when the capsule sweep intersects any collider, otherwise false.
See also
https://docs.unity3d.com/ScriptReference/Physics.CapsuleCast.html

◆ CapsuleCastNonAlloc() [1/2]

int Kit.Physic.CapsuleCastData.CapsuleCastNonAlloc ( Vector3  _point1,
Vector3  _point2,
float  _radius,
Vector3  _direction,
RaycastHit []  hits,
float  _maxDistance = Mathf.Infinity,
int  layerMask = Physics.DefaultRaycastLayers,
QueryTriggerInteraction  queryTriggerInteraction = QueryTriggerInteraction.UseGlobal 
)

Casts a capsule against all colliders in the scene and returns detailed information on what was hit into the buffer. Like Physics.CapsuleCastAll, but generates no garbage.

Parameters
_point1The center of the sphere at the start of the capsule.
_point2The center of the sphere at the end of the capsule.
_radiusThe radius of the capsule.
_directionThe direction into which to sweep the capsule.
_maxDistanceThe max length of the sweep.
layerMaskA Layer mask that is used to selectively ignore colliders when casting a capsule.
queryTriggerInteractionSpecifies whether this query should hit Triggers.
Returns
int The amount of hits stored into the buffer.
See also
https://docs.unity3d.com/ScriptReference/Physics.CapsuleCast.html

summary>Casts a capsule against all colliders in the scene and returns detailed information on what was hit into the buffer. Like Physics.CapsuleCastAll, but generates no garbage.

Parameters
layerMaskA Layer mask that is used to selectively ignore colliders when casting a capsule.
queryTriggerInteractionSpecifies whether this query should hit Triggers.
Returns
int The amount of hits stored into the buffer.
See also
https://docs.unity3d.com/ScriptReference/Physics.CapsuleCast.html

Referenced by Kit.Physic.RaycastHelper.GetCurrentStruct().

◆ CapsuleCastNonAlloc() [2/2]

int Kit.Physic.CapsuleCastData.CapsuleCastNonAlloc ( RaycastHit []  hits,
int  layerMask = Physics.DefaultRaycastLayers,
QueryTriggerInteraction  queryTriggerInteraction = QueryTriggerInteraction.UseGlobal 
)

to define it's being hit, hitted

◆ DrawAllGizmos()

void Kit.Physic.CapsuleCastData.DrawAllGizmos ( ref RaycastHit []  raycastHits,
int  validArraySize,
Color  color = default(Color),
Color  hitColor = default(Color) 
)

Provide vizualize information (Gizmos)

Parameters
raycastHitsThe cached array of Raycast result.
validArraySizeThe cached hit count from result.
colormain color of Gizmos
hitColorhit color of Gizmos

Implements Kit.Physic.IRayAllStruct.

Referenced by Kit.Physic.RaycastHelper.GetCurrentStruct().

◆ DrawGizmos()

void Kit.Physic.CapsuleCastData.DrawGizmos ( Color  color,
Color  hitColor 
)

Provide vizualize information (Gizmos)

Parameters
colormain color of Gizmos
hitColorhit color of Gizmos

Implements Kit.Physic.IRayStruct.

Referenced by Kit.Physic.RaycastHelper.GetCurrentStruct().

◆ GetEndPoints()

Vector3 [] Kit.Physic.CapsuleCastData.GetEndPoints ( float  _distance)

Get hit end point or point on max distance.

Returns
2 point

◆ Reset()

void Kit.Physic.CapsuleCastData.Reset ( )

Reset parameters

Implements Kit.Physic.IRayStructBase.

Referenced by Kit.Physic.RaycastHelper.GetCurrentStruct().

◆ ToString()

override string Kit.Physic.CapsuleCastData.ToString ( )

Provide vizualize information (Gizmos)

Implements Kit.Physic.IRayStructBase.

◆ Update()

void Kit.Physic.CapsuleCastData.Update ( Vector3  _point1,
Vector3  _point2,
float  _radius,
Vector3  _direction,
float  _maxDistance 
)

Update parameters

Parameters
_point1The center of the sphere at the start of the capsule.
_point2The center of the sphere at the end of the capsule.
_radiusThe radius of the capsule.
_directionThe direction into which to sweep the capsule.
_maxDistanceThe max length of the sweep.

Member Data Documentation

◆ direction

Vector3 Kit.Physic.CapsuleCastData.direction

The direction into which to sweep the capsule.

◆ maxDistance

float Kit.Physic.CapsuleCastData.maxDistance

The max length of the sweep.

◆ point1

Vector3 Kit.Physic.CapsuleCastData.point1

The center of the sphere at the start of the capsule.

◆ point2

Vector3 Kit.Physic.CapsuleCastData.point2

The center of the sphere at the end of the capsule.

◆ radius

float Kit.Physic.CapsuleCastData.radius

The radius of the capsule.

Property Documentation

◆ hitCount

int Kit.Physic.CapsuleCastData.hitCount
get

hit count from last physics check.

◆ hitResult

RaycastHit Kit.Physic.CapsuleCastData.hitResult
getset

hit result cached from last physics check.

Referenced by Kit.Physic.RaycastHelper.GetCurrentStruct().

◆ hitted

bool Kit.Physic.CapsuleCastData.hitted
get

bool, True if last physics result are hit.

Referenced by Kit.Physic.RaycastHelper.CheckPhysic(), and Kit.Physic.RaycastHelper.GetCurrentStruct().

◆ NONE

CapsuleCastData Kit.Physic.CapsuleCastData.NONE
staticget

The documentation for this struct was generated from the following file: