Raycast Gizmos visualizer  1.0
Kit.Physic.SphereCastData Struct Reference

Structure wrapper for SphereCast More...

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

Public Member Functions

 SphereCastData (Vector3 _origin, Vector3 _direction, float _distance, float _radius)
 
 SphereCastData (Ray _ray, float _distance, float _radius)
 
bool SphereCast (Vector3 _origin, float _radius, Vector3 _direction, float _maxDistance, int layerMask=Physics.DefaultRaycastLayers, QueryTriggerInteraction queryTriggerInteraction=QueryTriggerInteraction.UseGlobal)
 Casts a sphere along a ray and returns detailed information on what was hit. Notes: SphereCast will not detect colliders for which the sphere overlaps the collider. More...
 
bool SphereCast (int layerMask=Physics.DefaultRaycastLayers, QueryTriggerInteraction queryTriggerInteraction=QueryTriggerInteraction.UseGlobal)
 Casts a sphere along a ray and returns detailed information on what was hit. Notes: SphereCast will not detect colliders for which the sphere overlaps the collider. More...
 
int SphereCastNonAlloc (Vector3 _origin, float _radius, Vector3 _direction, float _maxDistance, RaycastHit[] hits, int layerMask=Physics.DefaultRaycastLayers, QueryTriggerInteraction queryTriggerInteraction=QueryTriggerInteraction.UseGlobal)
 
int SphereCastNonAlloc (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 _origin, float _radius, Vector3 _direction, float _maxDistance)
 Update parameters More...
 
void Reset ()
 Reset parameters More...
 
override string ToString ()
 Provide vizualize information (Gizmos) More...
 
Vector3 GetRayEndPoint ()
 Get hit end point or point on max distance. More...
 

Public Attributes

Vector3 origin
 The center of the sphere at the start of the sweep. More...
 
float radius
 The radius of the sphere. More...
 
Vector3 direction
 The direction into which to sweep the sphere. More...
 
float maxDistance
 The max length of the cast. More...
 

Properties

static SphereCastData 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 SphereCast

Constructor & Destructor Documentation

◆ SphereCastData() [1/2]

Kit.Physic.SphereCastData.SphereCastData ( Vector3  _origin,
Vector3  _direction,
float  _distance,
float  _radius 
)

◆ SphereCastData() [2/2]

Kit.Physic.SphereCastData.SphereCastData ( Ray  _ray,
float  _distance,
float  _radius 
)

Member Function Documentation

◆ DrawAllGizmos()

void Kit.Physic.SphereCastData.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.SphereCastData.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().

◆ GetRayEndPoint()

Vector3 Kit.Physic.SphereCastData.GetRayEndPoint ( )

Get hit end point or point on max distance.

Returns
point

◆ Reset()

void Kit.Physic.SphereCastData.Reset ( )

Reset parameters

Implements Kit.Physic.IRayStructBase.

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

◆ SphereCast() [1/2]

bool Kit.Physic.SphereCastData.SphereCast ( Vector3  _origin,
float  _radius,
Vector3  _direction,
float  _maxDistance,
int  layerMask = Physics.DefaultRaycastLayers,
QueryTriggerInteraction  queryTriggerInteraction = QueryTriggerInteraction.UseGlobal 
)

Casts a sphere along a ray and returns detailed information on what was hit. Notes: SphereCast will not detect colliders for which the sphere overlaps the collider.

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

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

◆ SphereCast() [2/2]

bool Kit.Physic.SphereCastData.SphereCast ( int  layerMask = Physics.DefaultRaycastLayers,
QueryTriggerInteraction  queryTriggerInteraction = QueryTriggerInteraction.UseGlobal 
)

Casts a sphere along a ray and returns detailed information on what was hit. Notes: SphereCast will not detect colliders for which the sphere overlaps the collider.

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

◆ SphereCastNonAlloc() [1/2]

int Kit.Physic.SphereCastData.SphereCastNonAlloc ( Vector3  _origin,
float  _radius,
Vector3  _direction,
float  _maxDistance,
RaycastHit []  hits,
int  layerMask = Physics.DefaultRaycastLayers,
QueryTriggerInteraction  queryTriggerInteraction = QueryTriggerInteraction.UseGlobal 
)

◆ SphereCastNonAlloc() [2/2]

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

to define it's being hit, hitted

◆ ToString()

override string Kit.Physic.SphereCastData.ToString ( )

Provide vizualize information (Gizmos)

Implements Kit.Physic.IRayStructBase.

◆ Update()

void Kit.Physic.SphereCastData.Update ( Vector3  _origin,
float  _radius,
Vector3  _direction,
float  _maxDistance 
)

Update parameters

Parameters
_originThe center of the sphere at the start of the sweep.
_radiusThe radius of the sphere.
_directionThe direction into which to sweep the sphere.
_maxDistanceThe max length of the cast.

Member Data Documentation

◆ direction

Vector3 Kit.Physic.SphereCastData.direction

The direction into which to sweep the sphere.

◆ maxDistance

float Kit.Physic.SphereCastData.maxDistance

The max length of the cast.

◆ origin

Vector3 Kit.Physic.SphereCastData.origin

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

◆ radius

float Kit.Physic.SphereCastData.radius

The radius of the sphere.

Property Documentation

◆ hitCount

int Kit.Physic.SphereCastData.hitCount
get

hit count from last physics check.

◆ hitResult

RaycastHit Kit.Physic.SphereCastData.hitResult
getset

hit result cached from last physics check.

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

◆ hitted

bool Kit.Physic.SphereCastData.hitted
get

bool, True if last physics result are hit.

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

◆ NONE

SphereCastData Kit.Physic.SphereCastData.NONE
staticget

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