Hello,
I have a pretty basic character set up, however I can’t seem to find a way to enable some functionality I need.
Currently the characters can push other objects around no problem, and that’s good.
The problem is that I also want other objects to be able to push the characters around too, however the characters seem to be locked in position if they aren’t moving, and so I can’t push them with other characters or actors. (Imagine infinite mass)
Changing the mass on the Movement Component doesn’t seem to do anything.
Is there any way to enable functionality like this?
Thanks.
EDIT: Does anybody have any ideas?
I’ve tried setting Simulate Physics to true, but that causes the Capsule Collider to just roll around the map ignoring player input.
I’ve also tried implementing some fake physics by detecting hits and changing velocity / launching based on them, however the movements seem very inconsistent and wrong.
I think I am about to give up and write my own character from base pawn.
Have you tried using Add Impulse? This could be more what you are looking for. Set it up to where if an object collides with the player, it adds impulse to the player and the capsule in the desired direction. Hopefully this helps!
Thanks for the reply.
That’s actually the first thing I tried… unfortunately it doesn’t seem like the Character uses standard physics - It doesn’t respond to Add Force, Add Impulse, or collisions, probably because Simulate Physics is false in the Capsule. If I enable Simulate Physics, the capsule just rolls around the map on its own and ignores player input, which kind of defeats the purpose of having a character…
I think a solution to this would be to write physics-based movement from the base Pawn, but it would be nice to keep all the client prediction and such of the Character.
Next try an addradialforcecomponent. I just tried it on my end and while you will have to play with how much force to add it seems to work. Let me know what you get!
What is the end goal of what you are trying to accomplish. Is the object pushing the actor just moving the character (for instance, a moving wall just pushing the player to a new location) or is it a forceful hit (for instance, a pinball paddle striking the pinball, which adds a force component to the object)? Thank you!
I have set up a new “character” with physics based movement which derives from Pawn, but of course has no Character Movement Component.
Forces are applied to character on the server with Add Force depending on the player input. Mass, drag, force have to be tweaked to get the movement right.
Pitch and roll are locked so that the character can only rotate yaw.
The results are great - realistic momentum, the character doesn’t stop suddenly when input is stopped, I can push other characters around just by bumping into them, and I can use Add Impulse to send them flying.
It replicates well too. I have to manually replicate the position, velocity, and yaw to the clients (and interp to smooth it a little) since “replicate movement” seems to cause desync. I’ve only tried it on the same machine though so it could be laggy without the client prediction in the Character Movement Component.
I’m not sure how good of a solution this is but it’s working pretty well so far.
Here’s an example I’m currently working on and it pushes my actors around when something hits them.
I circled the important stuff with blue, the red just shows I’m using a reference to the character movement and the yellow circles the variable that gives the impulse a little boost.
I also show my collision and physics settings. I have mostly everything on default.
However theres a slight issue, or maybe not so slight, where sometimes actors will get pushed way too fast for some reason and sometimes out of the game “world”. But at least they do get pushed with impulse on hits…
edit: oops noticed that this is a really old thread but for some reason it had a 3 day old comment.
Or there is the getto method, where you turn on the simulate physics before impact and after the effect is over you turn it off again. It needs some tweeking but it works.
I’m actually running into this issue years later. I can’t write my own code and am trying to accomplish this in blueprint. I just need an AI character to be pushed around by the force of a large projectile, but they are completely unmoved by forces applied to them.
Did anyone ever find a solution that wasn’t writing their own character blueprint?
No, and I’ve been stuck on this problem for months. Welcome to UE4 hell. (also please for the love of god tell me if you can ever get someone to give you a solid answer)