Was trying to think of a way of knocking my player back when he hit a specific obstacle (or, more to the point, when a specific obstacle hit HIM), and couldn’t really find much on the topic, but did come up with this solution. (Mostly the stuff along the top–the rest is just sound effects related to the hit, and ignoring anything else but the player character.)
Seems to work, but since I pretty much stumbled across it, I wanted to make sure there wasn’t a more logical way to do it.
One problem I’m having with this that I’m finding through play-testing, is occasionally I’m getting launched completely out of the level. I guess I need to go in and strip the Z component out of my launch velocity.
EDIT: Zeroing the Z component doesn’t make a difference. In fact, there IS no Z-Component from the GetForwardVector. And even though I’ve altered the LaunchCharacter to only use the Launch Velocity X, and Launch Velocity Y, I’m still getting launched WAY UP and out of the level on occasion. So I guess this is NOT the way to go about simply knocking back the player.
Thanks. I’m trying that as a temporary workaround for now, but hoping to find a way to get rid of the Z-Component altogether. I really only need my guy to get knocked back, not knocked up. (…okay, that doesn’t sound right…)
Yeah, actually, I was replying to yours when I noticed in MY quote of YOU that you had edited your response already! LOL!
Anyway, I think I found my fix for it. If I leave the Z component to be 0 (Even with the Z Override checked), it seems like it jumps back to some default behavior. BUT, if I specifically put something small (like 2) in there, and use the Z Override, that seems to do it. I’ve been testing this and (so far, anyway) haven’t been thrown out of the level anymore.
Your blocking volume would have probably worked, too, but since my game is completely generated on-the-fly, I didn’t want to have to deal with computing and adding individual blocking volumes in BP. Besides, I do need access to my “airspace” for a couple of player functions that I have.
My BP changed a little bit because I decided to create a “Pitfall Component” that will be used by any actors that I create to add different pitfalls and traps in the level. This way multiple actors can use the Kickback functionality (or whatever other pitfalls I create in here) and I’ve only got to edit the behavior in this one place for all of them.