Help me make a reactive capsule pushing system

midgunner66 “Yeah, mine in the video is set to 100 & 800, so that’s correct behavior.”

Ok so that is not too uncommon then, good to know.

“The reason is that when you multiply by delta seconds, the speed is in units-per-second (which is cm-per-second in Unreal). The reason for multiplying by delta seconds is that the speed the wall moves becomes independent of framerate; if not, the speed the wall moves will vary based on the framerate.”

Yeah I like the thought of that, movement speed that is independent of frame rate. Many modern PC games are locking players to 60 HZ when the systems are clearly capable of much more then that.

I set the target location to Y -2.0 and it has a decent left to right movement speed.

I finally got your code to work! Not sure what I did differently.

I made a video below of your code working.

But as you said before, this is a proof of concept, not a complete solution, so I do not think we are done here.

And while this is working as a demonstration, I’m not sure I totally understand how it does. The magic here must be in that hit result, I don’t get how it is referencing or accessing the third person character to move the capsule, when this code is all in a separate actor BP, and no cast to get access to the third person character.

I appreciate the help, thx again.

2 Likes

Yeah, there’s other problems. Like, if you have it push a physics object, and that physics object pushes against the character, the physics object will get squeezed between the wall and the character.

The actor it hits doesn’t matter because all we’re doing is setting the location of the actor, which can be done on all actors. Since the collision is set to pawn only, you don’t need to cast because we will only hit pawns, which is what a character is. It works on all actors, I only set it to pawn to stop warnings when it hit the walls.

No problem, it is kinda annoying that this doesn’t work already.

I noticed that the moving wall had the ability to push the player completely through the wall of the default third person character template. Any ideas how to fix that?

Ok

Yes, it is, I can’t believe this issue has not been solved yet. Does UE5 still have this problem?

In the meantime, I’m starting to wonder if this issue has to be solved on a per case basis with every moving platform in a level, in which case the speed of the moving wall will always be known for each platform. Which goes against my idea of creating a system that can compensate for anything moving, using only the third person character BP.

You can stop the wall by getting if the hit actor hits something during the move. This is just a thrown together example:

But this will stop the wall if the player hits anything, so you’d probably want to do more, like check what the player hit. But, assuming the wall is meant to crush the player, you can kill the player, too. You also aren’t limited to a sweep, you can use a trace as well, or anything else.

Haven’t tested, but I’m sure it does.

Yeah. But hit events fire for both actors that collide, so maybe this can be handled from the character bp instead. Edit: Did a quick test, and you can do this. I just have the wall bp only move with sweep on, and have the character BP handle the pushing part if it was hit.


The only problem is the wall randomly stops & starts sometimes. I don’t know why (think it may be that the hit isn’t firing every time for the character), but it should be easy to fix. Also, this does still use a target location variable, which means the wall actor has to have one for this to work; though, you can get it from any actor through an interface. Shouldn’t be a problem, but if it is, maybe using the trace end in the hit result or the wall’s normal can remove the need for it.

I added that boolean and the two branches and everything shown but yet the wall was still able to push my player through the outer wall of the TPC template.

Bummer…

Ok I adjusted the codes as shown.
In wall BP -

In TPC BP -

I got a strange effect, the wall stops when it hits the player and does a fast twitching thing until player moves away and then it advances again. Let me show you.

Any ideas what is going on here? Thanks!

Bump

bump

bump

Had this glitchy character pushing behavior and I tried literally every configuration of the movement component on the editor I could think of. Either this thread or another already had the info that if the character is slowly moving that the pushing will work fine. However (to me) this is not an option because it is not reliable and I don’t want characters to slowly move away from their spot.
I began using ALS (Advanced Locomotion System), the free plugin for human animations and I never noticed it again… Maybe they actually solved it. At some impact speeds it will trigger ragdoll as well which makes sense and works with pushing.

I don’t think it matters how fast or slow the movement is against the capsule the jerking would probably still remain.

ALS - I have not used it, from a few videos I watched it looks interesting. Seems pretty complex in its own right. Not sure it could help this situation though… But thanks for suggesting it!

bump bump

bump

bump

bump bump

There is another thread recently that has a solution that ALMOST worked.

I have a feeling this system might could be used to solve this problem…but I honestly am not sure why this helps this problem.

Bump bump anyone have anything on this? thanks!

bump bump

bump bump

Both Sweeps Off

Left node Sweep On, but Right node Sweep Off Yields - Y + smooth pushing

Right node Sweep On, but Left node Sweep Off Yields - X + smooth pushing

Both nodes Sweep On Yields - Y + smooth pushing

That solution (and I honestly don’t know why it helps this problem) can either be for the X or the Y, but not both simultaneously…why?

Well then…perhaps a way to make booleans fire sequentially but very very fast…would that work? What is happening here?

Thanks

bump bump

bump bump

And finally…this is it.

I found a combination that seemed to work both in X and Y. As far as I have seen, this seems to be the best capsule pushing element (for this problem IMHO) yet.

Simply place this in your third person character blueprint.

Leave X and Z alone in the two nodes. Set the left one to to 1 on the Y, and the right node to -1 on the Y. Set sweep off on the left one, sweep on on the right one.

I don’t fully understand how this works (something to do with collision calculation while moving?), but I’m not complaining. :slight_smile: I’m just glad this problem is finally solved.