I’ve made a little jumppad blueprint with (I think) all the necessary components, except, I do not really understand how to make the jumppad interact with the player character. Right now I’m just using the default player character.
I’m imagining I need to get the player actor’s velocity, and modify that, maybe with a gradient for acceleration. But I’m not really sure how to grab those values, or if they even exist. Any ideas?
edit: this issue has been solved, the solution can be read here!
edit2: And I even decided to make a little video guide on how to create this thing
That makes a lot of sense, but now I don’t really know how to grab or apply this stuff. I’ve been looking at tutorials on the tubes, but I can’t really figure out how to pull this off. Here’s a little collage of my process, to show where I am stuck!
I tried adding some random actions to the event, and it certainly triggers when I walk on it. However, I don’t really understand how I acquire whatever walked on it, so that I can affect it.
The nodes are context sensitive, so depending on the root item, in your case the mesh, you’ll see different options. Since the character has little to do in the context of that static mesh, you wont see options pertaining to your character when dragging nodes off of the static mesh. Start by right clicking the root object, and adding an overlap event. Right click in the gray area on your BP, uncheck context sensitive, find launch character, and connect that to the overlap node. For the target, right click in the gray area again, and Get Player Character.
You’ll want to find the right settings for your project, but this should accomplish a very, very basic launch pad. Also, in the component section of your blueprint, go down to collision for your launch pad, and set it to trigger (or something that overlaps with your character so it triggers the overlap event).
That will work for a single player scenario, but I’d like to think my jumppad could work in multiplayer. I was hoping I could ask the Event what triggered the overlap, and then apply the force to that actor. Or something like that.
In this example, I’m just working with a trigger box to work as jumppad. I’m trying to fetch the actual character that is touching the pad, and I’m really close. Basically I’m getting all overlapping actors, but filtering for MyCharacter, then throwing the results into an array. However, the Launch Character function can’t know for sure whether what is coming out of the array is actually a character, so it won’t accept it. Is there some way I can cast it, or perhaps verify it’s the right actor, so that it will be accepted?
You are pretty much on the spot already, try it and if it’s wrong, post the result.
You can further filter possible overlapping result by changing the collision behavior to ignore most type except Pawn.
(say a rocket won’t be bounce off by a launchpad)
I know I’m close, my problem is that the Launch Character function will not accept the output from the graphs below it, because I have no way of assuring it that it’s a valid character. Is there some way I can force it to accept it, or simply try it and reject it, if it isn’t a character?
edit: oww, I finally found it. Somehow, searching for “cast to” didn’t turn up the results, but after scouring the different functions manually, I found a way to cast actors. I’ll upload my graph soon!
Oki, so here’s what I eventually came up with, which actually worked. I cannot verify whether it will work in multiplayer, but I can’t see why it wouldn’t. The only weird scenario I can imagine happen, is two players entering the trigger volume at the exact same moment. I suppose it makes sense that only one person can use a jumppad at a time?
So basically I get all Character objects that overlap with the trigger volume, which gives me an array. Assuming only one character is inside the volume at a time (a reasonable assumption), I simply get the first index (0) and then cast that to a Character, so that Launch Character will accept it.
As I tried implementing this with my actual jumppad, I found out I can simply use the ‘Other actor’ output from the OnComponentBeginOverlap function, cast it to a character, and then give that to the Launch Character function. Neat. I suppose this also solves the concurrency issue mentioned above.
@PenguinTD, I looked into the for each loops, but they didn’t seem that helpful in this situation.
For future reference, this is where the casting functions are hiding!