![]() |
Corgi Engine v9.3
|
Prevents fast moving objects from going through colliders by casting a ray backwards after each movement More...
Public Types | |
enum | Modes { Raycast , BoxCast } |
Public Attributes | |
Modes | Mode = Modes.Raycast |
whether to cast a ray or a boxcast to look for targets More... | |
LayerMask | ObstaclesLayerMask |
the layer mask to search obstacles on More... | |
float | SkinWidth = 0.1f |
the bounds adjustment variable More... | |
bool | RepositionRigidbodyIfHitTrigger = true |
whether or not to reposition the rb if hitting a trigger collider More... | |
bool | RepositionRigidbodyIfHitNonTrigger = true |
whether or not to reposition the rb if hitting a non trigger collider More... | |
RaycastHit2D | Hit |
Protected Member Functions | |
virtual void | Start () |
On Start we initialize our object More... | |
virtual void | Initialization () |
Grabs the rigidbody and computes the bounds width More... | |
virtual void | OnEnable () |
On Enable, we initialize our last frame position More... | |
virtual void | Update () |
On fixedUpdate, checks the last movement and if needed casts a ray to detect obstacles More... | |
Protected Attributes | |
float | _smallestBoundsWidth |
float | _adjustedSmallestBoundsWidth |
float | _squaredBoundsWidth |
Vector3 | _positionLastFrame |
Rigidbody2D | _rigidbody |
Collider2D | _collider |
Vector2 | _lastMovement |
float | _lastMovementSquared |
RaycastHit2D | _hitInfo |
Vector2 | _colliderSize |
Prevents fast moving objects from going through colliders by casting a ray backwards after each movement
|
protectedvirtual |
Grabs the rigidbody and computes the bounds width
|
protectedvirtual |
On Enable, we initialize our last frame position
|
protectedvirtual |
On Start we initialize our object
|
protectedvirtual |
On fixedUpdate, checks the last movement and if needed casts a ray to detect obstacles
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
RaycastHit2D MoreMountains.Tools.MMPreventPassingThrough2D.Hit |
Modes MoreMountains.Tools.MMPreventPassingThrough2D.Mode = Modes.Raycast |
whether to cast a ray or a boxcast to look for targets
LayerMask MoreMountains.Tools.MMPreventPassingThrough2D.ObstaclesLayerMask |
the layer mask to search obstacles on
bool MoreMountains.Tools.MMPreventPassingThrough2D.RepositionRigidbodyIfHitNonTrigger = true |
whether or not to reposition the rb if hitting a non trigger collider
bool MoreMountains.Tools.MMPreventPassingThrough2D.RepositionRigidbodyIfHitTrigger = true |
whether or not to reposition the rb if hitting a trigger collider
float MoreMountains.Tools.MMPreventPassingThrough2D.SkinWidth = 0.1f |
the bounds adjustment variable