Use the character information (with examples)
The term information here covers everything related to public getters and flags such as collision flags, physics contacts, triggers, grounding status, and so on. These values can be very useful when creating new gameplay mechanics.
Grounded state
Wall collision example
The same can be applied to some other property, for example, if we need to trigger some animation parameter only when the character is touching a wall:
Wall running behavior
Slide movement
Let's say our character is standing on a steep slope (unstable state) and we want to make it slide down. What we can do is getting the unstable state first and then applying the movement.
However, the character can be unstable while it's in the air, so we need to be sure the character is grounded as well:
Now, lets add one more condition. We want to execute the slide movement 1 second after making contact with this unstable surface. One way to do this is by using a property called GroundedTime (you have also NotGroundedTime, StableGroundedTime and UnstableGroundedTime).
So, this is the final code:
Last updated