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"

I want my character to fly in a specific way

so i want my character to fly and this is what i have so far this makes him jump and takes him in and out of flying mode which is a good start but i want him to fly in the direction of the camera if i hold W and i want him to be able to go up with space and down with shift if he is in the air can someone please help?

alt text

Product Version: UE 4.18
Tags:
capture.png (130.0 kB)
more ▼

asked Jun 15 '18 at 03:16 AM in Blueprint Scripting

avatar image

dwarfinator1
1 1 2 3

avatar image ThompsonN13 Jun 15 '18 at 03:28 AM

The movement part is actually pretty simple. For the forward movement you just need the input event, a add movement input node, and then to control the direction use get actor rotation and get forward vector. For an example look at the thirdperson character template. For the up and down movement you do basically the same thing except you use the get up vector for the direction.

I made this same setup for a project earlier. Im not on my pc now but ill try to post pictures in the am. Like o said though is pretty much just like in the thirdperson template.

Edit: added pictures and fixed spelling.

alt text

alt text

capture.png (238.3 kB)
capture1.png (191.8 kB)
avatar image dwarfinator1 Jun 15 '18 at 03:50 AM

Forgot to mention this is the third person blueprint but thanks!

avatar image dwarfinator1 Jun 15 '18 at 10:02 PM

for the forward and backward movement i am using a keyboard so should i use W for the Y axis and S for the X axis?

avatar image ThompsonN13 Jun 15 '18 at 10:37 PM

no that wouldnt make any sense, if you had w on one axis and s on a different then that would be like having w move forward and s move right. what you should do is to make a input axis event in the project settings ->engine->input. make an axis input event and have w as a value of 1 and s have a value of -1 (if your in the third person example this should already exist). you can do the same thing for your altitude adjustment for flying too.

it has also just occurred to me that when you mentioned axis you may have been referring to my second picture above, in the picture the thumbstick x axis event is for strafing left and right (direction based on right vector). the y axis event was the one for forward and backward movement. the event with the comment turn on it is for turning / rotating the character.

alt text

capture.png (133.6 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Simplest version is get the pawn's camera, get Forward Vector of that, multiply the forward vector by the number of unreal units you want to move forward per tick and then SetActorLocation to current location plus that vector you just calculated.

For space bar rising straight up motion, then you can map an input axis of positive 1.0 to the space bar, make an input axis event for that, multiply the input axis value by the number of unreal units you want to go straight up per tick, plug that into the Z of a makeVector node then setActorLocation to the current location plus that vector you made.

more ▼

answered Jun 15 '18 at 03:30 AM

avatar image

mightyenigma
3.8k 18 23 20

(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