The title says it all, how can i make my character jump only when it is inside a trigger box?
Just so you know i disabled the jumping from my character and i want him to jump only when inside a trigger box.
It should be really simple i think but i’m still a noob, any help would be appreciated.
There’s a couple of ways you could do it. The simplest would be to have a variable in your character called something like JumpEnabled default it to false and put a branch after the jump input that is fed that variable, then when the character enters the box set the variable to true.
You could also do it through editing the character movement component but this is the absolute simplest way to do it.
theres many ways to accomplish this.
you could check to see if character overlapping trigger box before running the actual jump script. so it would be something like input event → get overlapping actors of type trigger box, get length, length > 0 → branch, if true jump.
or theres always the on begin overlap, cast to triggerbox, is success set canjump? variable to true. then have the jump input, is can jump true branch, if yes jump.
the first method will allow jump in any trigger box. if you want jumping only in a certain single trigger box then you will need to either be more specific with the filter or more realistically use the variable method and control it from the level bp. the level bp is the place to script one off events and it allows you to target specific actors easily. so in the level bp you would have a reference to the trigger and on begin overlap of the trigger you compare other actor to player character, then cast to the characters class and set the can jump variable in the character.
elaborate on the specifics of your game and we can tell you a good way to go.
OMG! Thank you… i thought i was never gonna find the solution, thank you… finally, I can move on to the next level of my project. You really helped me