The base collision behaviour stops the character from passing through obstacles. It is called by most Movement<c> calls after they have finished movement to ensure that the character doesn't penetrate level geometry. Movement
More...
|
virtual void | Init (Character character) |
| Initialise this instance. Called by the cahracter on start. More...
|
|
virtual Vector2 | DoCollisions (RaycastType typeMask, int layerMask, int passthroughLayerMask) |
| Check for collider penetration of the given types on the given layers and move the character if found. More...
|
|
virtual bool | IsGrounded () |
| Is the character grounded based on the last time collisions were calculated? More...
|
|
The base collision behaviour stops the character from passing through obstacles. It is called by most Movement<c> calls after they have finished movement to ensure that the character doesn't penetrate level geometry. Movement
◆ AddColliderToSentMessageReceivers()
virtual void PlatformerPro.BaseCollisions.AddColliderToSentMessageReceivers |
( |
Collider2D |
collider | ) |
|
|
protectedvirtual |
Adds a colldier to the list of colliders that received the Collide() message.
- Parameters
-
◆ DoCollisions()
virtual Vector2 PlatformerPro.BaseCollisions.DoCollisions |
( |
RaycastType |
typeMask, |
|
|
int |
layerMask, |
|
|
int |
passthroughLayerMask |
|
) |
| |
|
virtual |
Check for collider penetration of the given types on the given layers and move the character if found.
- Parameters
-
typeMask | The types to consider. |
layerMask | The layers to consider. |
- Returns
- A vector representing the amount of movement applied.
◆ HasReceivedCollideMessage()
virtual bool PlatformerPro.BaseCollisions.HasReceivedCollideMessage |
( |
Collider2D |
collider | ) |
|
|
protectedvirtual |
Determines whether the provided collider has received Collide() message this frame.
- Returns
true
if the collider has received Collide() message; otherwise, false
.
- Parameters
-
◆ Init()
virtual void PlatformerPro.BaseCollisions.Init |
( |
Character |
character | ) |
|
|
virtual |
Initialise this instance. Called by the cahracter on start.
- Parameters
-
◆ IsGrounded()
virtual bool PlatformerPro.BaseCollisions.IsGrounded |
( |
| ) |
|
|
virtual |
Is the character grounded based on the last time collisions were calculated?
◆ ResetCollisions()
virtual void PlatformerPro.BaseCollisions.ResetCollisions |
( |
| ) |
|
|
protectedvirtual |
Clear the array of colliders that have received Collide() messages.
◆ assumeConstantGravityAndFeetDistance
bool PlatformerPro.BaseCollisions.assumeConstantGravityAndFeetDistance |
|
protected |
If gravity and feet length is constant we can do less calculations for passthrough platforms.
◆ character
Character PlatformerPro.BaseCollisions.character |
|
protected |
Cached reference to the character.
◆ closestColliders
int [] PlatformerPro.BaseCollisions.closestColliders |
|
protected |
Keeps track of the closest collisions.
◆ collidersAlreadySentMessages
Collider2D [] PlatformerPro.BaseCollisions.collidersAlreadySentMessages |
|
protected |
An array of colldiers which received an action message this frame.
◆ grounded
bool PlatformerPro.BaseCollisions.grounded |
|
protected |
Keeps track of the grounded state ccording to the last time collisions were executed.
◆ platformCollisionArgs
The platform collision arguments. Avoid creating a new one each frame.
◆ timeToFallFeetDistance
float PlatformerPro.BaseCollisions.timeToFallFeetDistance |
|
protected |
Calcualte how long it would take to fall feet distance with the current gravity. We use this to control passthrough platform application.
◆ ClosestColliders
int [] PlatformerPro.BaseCollisions.ClosestColliders |
|
get |
Make closest collisions available so we don't need to calculate twice.
The documentation for this class was generated from the following file:
- D:/Projects/platformer-pro-2019.3/Assets/PlatformerPro/Scripts/Movement/BaseCollisions.cs