Announcement

Collapse
No announcement yet.

How do I push another character?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    Thank you very much for your answer. This gives me a few things to try out. Thanks again :-)

    Leave a comment:


  • replied
    Adding a radial force component near the feet of your character and firing it upon landing may be feasible for your application. Just be careful that this doesn't overlap with geometry as it will, by default, only push actors that are not blocked on the visibility channel. You could also perform a sphere trace with the same radius, and whomever is within the sphere trace (which I would perform just before the firing of the impulse) you can call an RPC for a "stunned" animation, or whatever you choose to do. In that circumstance I'd personally have the RPC simply flag the character with an "isStunned" boolean, and handle the animation in your anim BP, and finally handle setting "isStunned" to false after a short amount of time. Personally, I'd avoid delays here as well, and simply count frame delta until your ideal time has elapsed.

    Impulse isn't as reliable as other solutions, however. A more ideal approach might be to simply conduct the sphere trace upon landing, call the RPC(s) on any actor(s) hit by the trace, and have a root motion "stunned"/"knocked back" montage fire off. Then you have complete control, via your animation(s), of what happens. With impulse, some wild things can happen which is typically great for a rocket launcher, but not so great for knocking back enemies in a consistent manner.

    What I personally REALLY like about montages, is that they can be interrupted and you can account for that. If you knock someone off of a cliff, for example, your falling animation (if it already exists in your Anim BP and is setup properly) will interrupt the montage. This looks very nice, and would prevent a glitchy-looking "I'm walking back in a dazed state" animation in mid-air (or while falling).
    Last edited by One Mode Only; 03-13-2019, 07:35 PM.

    Leave a comment:


  • replied
    Originally posted by Nawrot View Post
    You need to script it all. For actual pushing you can use physics or just modify their location.
    But then enemy needs to know its being pushed and need to play animation for it.
    So your task can be split into two: pushing (changing enemy location) and playing animation when it happens.

    Watch some tutorials about animation blueprints and using animations.
    Thanks, I don't think I can use any of this, it needs to be a bit more specific, like how do I change enemy location, to just be a little bit away from the source that is pushing?

    Leave a comment:


  • replied
    You need to script it all. For actual pushing you can use physics or just modify their location.
    But then enemy needs to know its being pushed and need to play animation for it.
    So your task can be split into two: pushing (changing enemy location) and playing animation when it happens.

    Watch some tutorials about animation blueprints and using animations.

    Leave a comment:


  • started a topic How do I push another character?

    How do I push another character?

    Hi everyone

    I have a hero character, and an enemy character (it's a dead cells like game).. I wan't my character to be able to push the enemy characters. Like when I jump and land on an enemy, I want the enemy to get pushed aside, cause often I get stuck between an enemy and a wall. I want to use this to be able to push enemies over legdes, or use it for weapons with knockback, and many things like that...
    Any ideas on how to do this? All the enemy AI is done in blueprints (no blackboards or behavior trees), simply blueprints. I'm no programmer, so blueprints is more logical to me, than behavior trees and so.

    Any help will be very much appreciated, thanks :-)

    Here's a video of my game, if you need to have a look
    https://youtu.be/oA0bYSnAoyw

    -Ronnie Ree
Working...
X