Gracefully move the player back from an invisible wall / blocking volume?

In some AAA titles there’s a technique I’ve seen where instead of stopping a player immediately when hitting an invisible wall, the game will let them move into it a bit and then it will push them back out. Halo 3 is the first title I saw that did this in multiplayer.

Has anyone seen a good technique for doing this in Unreal? Can you do it with the built in blocking volumes or do you need to build something custom for it?

I have some objects floating in my levels that I don’t want the camera to immediately stop on from collision, I’d like the camera to gracefully slow down and get pushed back when hitting them.

I would imagine at a high level you would do something like the following:

  • If the player is close to the object you want to apply this behavior on
  • Get the player’s forward vector and their speed
  • Then over a 1 second time window, apply a force to them in the opposite vector with a bigger speed than what they came in with? I’m probably way off.

Hi,
Seems like you already have a decent solution for it. Only thing I would do differently is ignore the players speed and just slowly stop him over, lets say 1 second and then start applying stronger and stronger force that is pushing him in an opposite direction of the wall. This interaction would probably last in total 2-3 seconds. For the volumes, I would probably create a BP with box overlap volume and a custom vector to set in which direction to push player when he interacts with the box.

1 Like

Thank you, that’s quite helpful, ignoring the speed and slowing them down makes a lot of sense. What about if you wanted the volumes around certain objects? Could you use their collision mesh in some way or would you attach sphere or box trigger volumes to those objects?

For that I would probably use a larger sphere and leave the object with the blocking collision, just so it never happens that player starts going through the object. For that you can also get the direction of the push from location of the player and location of the object. Of course if the object is a literal box, maybe box overlap is better, but for most other objects, probably sphere.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.