Launch Character node fighting with swim movement
Hi! I recently finished my first project on UE4 (it was my first game at all, actually: check some screens here if you're curious: https://www.artstation.com/artwork/YabdYY) and I've already started to create my new game - it's a sort of dungeon crawler. Well, among the various mechanics, I wanted to do that if you swim in water, the water can have a powerful enough flow to push you in the direction it's flowing. I used a simple launch character node for that - note that the actor that pushes you is the same that contains a surface material and a post processing volume, the water volume instead is a separate, overlapping object.
The problem is: when I use the Launch Character node, and then I try it out jumping into water, it pushes you in the direction it should push you - but it also does not allow you to swim up. It literally pushes you down (while it pushes it in the right direction too). I couldn't solve this problem in any way. Any idea guys? It would be super amazing to have this mechanic in the game but I really can't solve this one!
asked Apr 09 '19 at 12:04 PM in Blueprint Scripting
Hey! Thanks for the help aNorthStar, you set me on the right path. When you told me launch character was setting my char movement to "falling" I realized why I was having that problem. So after some time and work I understood I had to use physics to achieve what I wanted - but I still wanted a simpler, possibly physicsless solution (especially because physics are pretty hard to control and tend to be very glitchy. So I had an illumination and came out with an alternative solution!
The solution: just add movement input to your character through the liquid BP (I used delta seconds as time input). Use a custom event that can store a vector (the flow direction) and a float (the flow strength) and it'll work perfectly! I also used a boolean to check if the player was being pushed by the flow (flow>0) and then if it was true the axis of the movement input was clamped to lower values - now it looks really realistic, the char seems to fight against the flow!
answered Apr 10 '19 at 09:51 AM
I'm not quite sure how your player Character component is set up for movement in water... the movement mode... but it might be your use of the Launch mode: this fires just once when it is called (its not a setting) , and then automatically sets the movement mode to "falling" (not "flying" or "swimming").
I think if you are looking into adding a constant force on your character, like a river's flow force, maybe use Force node, Impulse node or a Thruster component instead for this. The Launch node might be more useful when you are leaving the water physics volume and hopping up on land (although I think there is an automatic function for this too, either in the Character component or the physics volume)
Follow this question
Once you sign in you will be able to subscribe for any updates here