x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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.

http://imgur.com/a/8QP8J

Product Version: UE 4.8
Tags:
more ▼

asked Jul 30 '15 at 02:06 AM in Blueprint Scripting

avatar image

skobes
6 2 3 2

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Hello @skobes,

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.

alt text

Next I would take this stored velocity and add it back to the character right after you make your transition from flying to walking.

alt text

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.

alt text

I hope this answer helps,

Farshooter

velchange 1.png (37.3 kB)
velchange 2.png (33.2 kB)
velchange 3.png (45.6 kB)
more ▼

answered Jul 30 '15 at 11:18 PM

avatar image

BitBoy92
493 53 38 57

avatar image skobes Jul 31 '15 at 12:54 AM

The rotation part worked perfectly. I never knew I could right click and split the node into the separate axis, that's what I had been looking to do. So thank you!

However the velocity didn't seem to work.

avatar image BitBoy92 Jul 31 '15 at 01:06 AM

Hmm... That's weird in my test it worked without a hitch. Could you post of picture of your code when you switch from flying to walking?

avatar image skobes Jul 31 '15 at 01:14 AM

http://i.imgur.com/5Y7NJAP.png

This is what I have.

avatar image BitBoy92 Aug 01 '15 at 02:11 AM

I tried your setup and found that it was definitely preserving some velocity. It seems like it would slow down though after the switch. This most likely is setting in the character movement controller.

Another technique you can try is to use the add impulse node instead of setting the velocity. This technique will physically accelerate the object. Check out the code below. alt text

Side Note: You may have to tweak the scale of the velocity to get your desired behavior. I found that checking the "Velocity Change" field gives the character a nice boost when switching at fast speeds. This may be what you are looking for.

Farshooter

velchange 4.png (57.0 kB)
avatar image skobes Aug 01 '15 at 09:36 PM

I think something else is affecting this then. I've tried doing this again, and also tried that exact add impulse, yet there's still zero movement once I switch movement modes. I just drop like a rock from the sky.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Switch to Falling instead of Walking?

more ▼

answered Jul 19 '17 at 10:56 PM

avatar image

Holystride
1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question