How to make my character bounce against walls

  • when the Player Capsule touches the wall, the Hit Event may trigger multiple times as we end up sliding along the wall; DoOnce + Delay .2s ensures Hit is handled no more than 5x per second. It’s more of a safety measure.
  • tags allow to ID hit components easily; admittedly there are other ways to do it, some better than others - it all depends on how things are structured
  • OnComponentHit’s Normal is the direction the wall is facing
  • Mirror Vector explains what is does in the tooltip very nicely - shining a laser at the mirror (Normal), yada, yada…
  • GetLastUpdateVelocity - when we hit the wall, our velocity changes (we change direction or even stop completely) so we cannot use just Velocity for the calculations to find a new traverse direction. Instead we take the most recent velocity before colliding - whatever was accumulated in that vector last frame / update.
  • the multiplier should really be <= 1 but it’s more fun like this
4 Likes