Changing movement modes - resetting yaw/pitch and keeping velocity
Currently swapping movement modes between fly and walk with a key press. I've copied over the entire movement mode of the Flying blueprint feature and tossed it into the ThirdPersonCharacter blueprint. I have a few branches set from key presses, which tells it to either move forward on the ground if walking, or pitch down if in flight.
It works almost perfectly. With a key press I'm flying like superman or an airplane, and then walking around back on the ground.
However I've come to a problem. When swapping back to the walking movement mode, my character stops mid-air and falls back to the ground. I'm trying to have him retain his speed and slow down over a few seconds, but I'm at a bit of a loss where to begin.
The other problem is that he's keeping the air rotation and then runs along the ground at an angle. He can be almost belly down, horizontal with the ground while flying, switch back, and then keep that rotation while in walking mode.
I feel like I'm just unsure of which commands to use, I've tried using Event OnMovementModeChanged, unsuccessfully.
I'm not sure where the problem is, so I've tossed in a bunch of screenshots. It's essentially just the Flight game blueprint added to third person.
If you can guide me in any direction, it would be greatly appreciated.
asked Jul 30 '15 at 02:06 AM in Blueprint Scripting
For keeping the character velocity, I would store the velocity of the character movement component in a local variable just before you make the transition from air to ground. Kind of like the picture below.
Next I would take this stored velocity and add it back to the character right after you make your transition from flying to walking.
This should preserve your velocity without any weird hitches.
Now to rotate your character so that its you vector is (0, 0, 1) as you transition to from flight mode to walking mode, you will want to use the following code below. This code just sets the rotation to its previous rotation ignoring the Pitch and Roll of the object.
I hope this answer helps,
answered Jul 30 '15 at 11:18 PM
Switch to Falling instead of Walking?
answered Jul 19 '17 at 10:56 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here