C# Class UnityPlatformer.RaycastController

Inheritance: UnityEngine.MonoBehaviour
Afficher le fichier Open project: llafuente/unity-platformer

Méthodes publiques

Свойство Type Description
collisionMask UnityEngine.LayerMask
horizontalRayCount int
minDistanceToEnv float
skinWidth float
verticalRayCount int

Méthodes publiques

Méthode Description
CalculateRaySpacing ( ) : void

Recalculate distance between rays (horizontalRaySpacing & verticalRaySpacing)

FeetRay ( float rayLength, LayerMask mask ) : RaycastHit2D

Return RaycastHit2D of Raycasting at bottom center.

ForeachFeetRay ( float rayLength, Vector3 &velocity, RayItr itr ) : void

Iterate over all feet/vertical rays

ForeachHeadRay ( float rayLength, Vector3 &velocity, RayItr itr ) : void

Iterate over all head/vertical rays

ForeachLeftRay ( float rayLength, Vector3 &velocity, RayItr itr ) : void

Iterate over all left/horizontal rays

ForeachRightRay ( float rayLength, Vector3 &velocity, RayItr itr ) : void

Iterate over all right/horizontal rays

LeftFeetRay ( float rayLength, Vector3 velocity ) : RaycastHit2D

Return RaycastHit2D of Raycasting at bottom left.

OnEnable ( ) : void

Recalculate everything

Raycast ( Vector2 origin, Vector2 direction, float rayLength, int mask, Color color = null ) : RaycastHit2D

Call Physics2D.Raycast and Draw the ray to debug

RightFeetRay ( float rayLength, Vector3 velocity ) : RaycastHit2D

Return RaycastHit2D of Raycasting at bottom right.

UpdateInnerBounds ( ) : void

Recalculate shrinked the bounds

UpdateRaycastOrigins ( ) : void

Recalculate raycastOrigins

VerticalRay ( float directionY, int index, float rayLength, Vector3 &velocity, Color c = null ) : RaycastHit2D

Return RaycastHit2D of Raycasting at given index

Method Details

CalculateRaySpacing() public méthode

Recalculate distance between rays (horizontalRaySpacing & verticalRaySpacing)
public CalculateRaySpacing ( ) : void
Résultat void

FeetRay() public méthode

Return RaycastHit2D of Raycasting at bottom center.
public FeetRay ( float rayLength, LayerMask mask ) : RaycastHit2D
rayLength float
mask UnityEngine.LayerMask
Résultat UnityEngine.RaycastHit2D

ForeachFeetRay() public méthode

Iterate over all feet/vertical rays
public ForeachFeetRay ( float rayLength, Vector3 &velocity, RayItr itr ) : void
rayLength float
velocity Vector3
itr RayItr
Résultat void

ForeachHeadRay() public méthode

Iterate over all head/vertical rays
public ForeachHeadRay ( float rayLength, Vector3 &velocity, RayItr itr ) : void
rayLength float
velocity Vector3
itr RayItr
Résultat void

ForeachLeftRay() public méthode

Iterate over all left/horizontal rays
public ForeachLeftRay ( float rayLength, Vector3 &velocity, RayItr itr ) : void
rayLength float
velocity Vector3
itr RayItr
Résultat void

ForeachRightRay() public méthode

Iterate over all right/horizontal rays
public ForeachRightRay ( float rayLength, Vector3 &velocity, RayItr itr ) : void
rayLength float
velocity Vector3
itr RayItr
Résultat void

LeftFeetRay() public méthode

Return RaycastHit2D of Raycasting at bottom left.
public LeftFeetRay ( float rayLength, Vector3 velocity ) : RaycastHit2D
rayLength float
velocity Vector3
Résultat UnityEngine.RaycastHit2D

OnEnable() public méthode

Recalculate everything
public OnEnable ( ) : void
Résultat void

Raycast() public méthode

Call Physics2D.Raycast and Draw the ray to debug
public Raycast ( Vector2 origin, Vector2 direction, float rayLength, int mask, Color color = null ) : RaycastHit2D
origin Vector2
direction Vector2
rayLength float
mask int
color Color
Résultat UnityEngine.RaycastHit2D

RightFeetRay() public méthode

Return RaycastHit2D of Raycasting at bottom right.
public RightFeetRay ( float rayLength, Vector3 velocity ) : RaycastHit2D
rayLength float
velocity Vector3
Résultat UnityEngine.RaycastHit2D

UpdateInnerBounds() public méthode

Recalculate shrinked the bounds
public UpdateInnerBounds ( ) : void
Résultat void

UpdateRaycastOrigins() public méthode

Recalculate raycastOrigins
public UpdateRaycastOrigins ( ) : void
Résultat void

VerticalRay() public méthode

Return RaycastHit2D of Raycasting at given index
public VerticalRay ( float directionY, int index, float rayLength, Vector3 &velocity, Color c = null ) : RaycastHit2D
directionY float
index int
rayLength float
velocity Vector3
c Color
Résultat UnityEngine.RaycastHit2D

Property Details

collisionMask public_oe property

Static geometry mask
public LayerMask,UnityEngine collisionMask
Résultat UnityEngine.LayerMask

horizontalRayCount public_oe property

How many rays to check horizontal collisions
public int horizontalRayCount
Résultat int

minDistanceToEnv public_oe property

How far from then env the Character must be. NOTE: must be less than skinWidth, to allow continuous ground contact
public float minDistanceToEnv
Résultat float

skinWidth public_oe property

Defines how far in from the edges of the collider rays are we going to cast from. NOTE: This value must be greater than minDistanceToEnv
public float skinWidth
Résultat float

verticalRayCount public_oe property

How many rays to check vertical collisions
public int verticalRayCount
Résultat int