Make Character slide after getting hit by a projectile

Try this:

You can mass copy/paste nodes from here but you’ll need to clean it up.

To control push power, multiply Reaction Velocity before setting it after Do Once. Currently it’s a direct translation of the projectile’s velocity. The Interp Speed will affect how quickly we recover from the slide, slow down. For more granular control, the interpolation method can be improved by sampling a predefined curve.

The above produces this:

Known issues - due to the method used, it will also produce this (exaggerated the power to demonstrate):

A couple of ways to solve it:

  • when hitting simulating obstacles, push them away, too and keep going in the original direction

and / or

  • when hitting a stationary obstacle, get the surface normal and slide along its right vector. So when we arrive at its edge, we’re still moving in a logical direction.

or

  • stop sliding when an obstacle is hit - the easiest fix but may be undesirable due to the game mechanics expectations

Also, never tested it with something applying additional movement input.

1 Like