Raycast Gizmos visualizer  1.0
Kit.Physic.RaycastData Struct Reference

Structure wrapper for Raycast More...

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

Public Member Functions

 RaycastData (Vector3 _origin, Vector3 _direction, float _distance)
 
 RaycastData (Ray ray, float distance)
 
bool Raycast (Vector3 _origin, Vector3 _direction, float _maxDistance=Mathf.Infinity, int layerMask=Physics.DefaultRaycastLayers, QueryTriggerInteraction queryTriggerInteraction=QueryTriggerInteraction.UseGlobal)
 Casts a ray, from point origin, in direction direction, of length maxDistance, against all colliders in the scene. More...
 
bool Raycast (int layerMask=Physics.DefaultRaycastLayers, QueryTriggerInteraction queryTriggerInteraction=QueryTriggerInteraction.UseGlobal)
 Casts a ray, from point origin, in direction direction, of length maxDistance, against all colliders in the scene. More...
 
int RaycastNonAlloc (Vector3 _origin, Vector3 _direction, ref RaycastHit[] hits, float _maxDistance=Mathf.Infinity, int layerMask=Physics.DefaultRaycastLayers, QueryTriggerInteraction queryTriggerInteraction=QueryTriggerInteraction.UseGlobal)
 Physics.RaycastNonAlloc More...
 
int RaycastNonAlloc (ref RaycastHit[] hits, int layerMask=Physics.DefaultRaycastLayers, QueryTriggerInteraction queryTriggerInteraction=QueryTriggerInteraction.UseGlobal)
 Physics.RaycastNonAlloc More...
 
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, 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 starting point of the ray in world coordinates. More...
 
Vector3 direction
 The direction in which to cast the ray. More...
 
float maxDistance
 The max length of the cast. More...
 

Properties

static RaycastData 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 Raycast

Constructor & Destructor Documentation

◆ RaycastData() [1/2]

Kit.Physic.RaycastData.RaycastData ( Vector3  _origin,
Vector3  _direction,
float  _distance 
)

◆ RaycastData() [2/2]

Kit.Physic.RaycastData.RaycastData ( Ray  ray,
float  distance 
)

Member Function Documentation

◆ DrawAllGizmos()

void Kit.Physic.RaycastData.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.

◆ DrawGizmos()

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

Provide vizualize information (Gizmos)

Parameters
colormain color of Gizmos
hitColorhit color of Gizmos

Implements Kit.Physic.IRayStruct.

◆ GetRayEndPoint()

Vector3 Kit.Physic.RaycastData.GetRayEndPoint ( )

Get hit end point or point on max distance.

Returns
point

◆ Raycast() [1/2]

bool Kit.Physic.RaycastData.Raycast ( Vector3  _origin,
Vector3  _direction,
float  _maxDistance = Mathf.Infinity,
int  layerMask = Physics.DefaultRaycastLayers,
QueryTriggerInteraction  queryTriggerInteraction = QueryTriggerInteraction.UseGlobal 
)

Casts a ray, from point origin, in direction direction, of length maxDistance, against all colliders in the scene.

Parameters
_originThe starting point of the ray in world coordinates.
_directionThe direction of the ray.
_maxDistanceThe max distance the ray should check for collisions.
layerMaskA Layer mask that is used to selectively ignore Colliders when casting a ray.
queryTriggerInteractionSpecifies whether this query should hit Triggers.
Returns
bool True if the ray intersects with a Collider, otherwise false.

◆ Raycast() [2/2]

bool Kit.Physic.RaycastData.Raycast ( int  layerMask = Physics.DefaultRaycastLayers,
QueryTriggerInteraction  queryTriggerInteraction = QueryTriggerInteraction.UseGlobal 
)

Casts a ray, from point origin, in direction direction, of length maxDistance, against all colliders in the scene.

Parameters
layerMaskA Layer mask that is used to selectively ignore Colliders when casting a ray.
queryTriggerInteractionSpecifies whether this query should hit Triggers.
Returns
bool True if the ray intersects with a Collider, otherwise false.

◆ RaycastNonAlloc() [1/2]

int Kit.Physic.RaycastData.RaycastNonAlloc ( Vector3  _origin,
Vector3  _direction,
ref RaycastHit []  hits,
float  _maxDistance = Mathf.Infinity,
int  layerMask = Physics.DefaultRaycastLayers,
QueryTriggerInteraction  queryTriggerInteraction = QueryTriggerInteraction.UseGlobal 
)

Physics.RaycastNonAlloc

Parameters
_originThe starting point of the ray in world coordinates.
_directionThe direction of the ray.
_maxDistanceThe max distance the ray should check for collisions.
hitsoutput RaycastHit
layerMask
queryTriggerInteraction
Returns
hit object counter

◆ RaycastNonAlloc() [2/2]

int Kit.Physic.RaycastData.RaycastNonAlloc ( ref RaycastHit []  hits,
int  layerMask = Physics.DefaultRaycastLayers,
QueryTriggerInteraction  queryTriggerInteraction = QueryTriggerInteraction.UseGlobal 
)

Physics.RaycastNonAlloc

Parameters
hitsoutput RaycastHit
layerMask
queryTriggerInteraction
Returns
hit object counter

to define it's being hit, hitted

◆ Reset()

void Kit.Physic.RaycastData.Reset ( )

Reset parameters

Implements Kit.Physic.IRayStructBase.

◆ ToString()

override string Kit.Physic.RaycastData.ToString ( )

Provide vizualize information (Gizmos)

Implements Kit.Physic.IRayStructBase.

◆ Update()

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

Update parameters

Parameters
_originThe starting point of the ray in world coordinates.
_directionThe direction of the ray.
_maxDistanceThe max distance the ray should check for collisions.

Member Data Documentation

◆ direction

Vector3 Kit.Physic.RaycastData.direction

The direction in which to cast the ray.

◆ maxDistance

float Kit.Physic.RaycastData.maxDistance

The max length of the cast.

◆ origin

Vector3 Kit.Physic.RaycastData.origin

The starting point of the ray in world coordinates.

Property Documentation

◆ hitCount

int Kit.Physic.RaycastData.hitCount
get

hit count from last physics check.

◆ hitResult

RaycastHit Kit.Physic.RaycastData.hitResult
getset

hit result cached from last physics check.

◆ hitted

bool Kit.Physic.RaycastData.hitted
get

bool, True if last physics result are hit.

◆ NONE

RaycastData Kit.Physic.RaycastData.NONE
staticget

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