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 to make a dash the moves in the direction the character is moving not in the direction the character is looking.

The Dash in this line of code works whenever I press shift, However the problem is that it dashes in the location that the character is looking, kind of like gengi's dash. What I want to happen is have the player dash in the direction that the character is moving at the time of the key press regardless of camera orientation. Please Help!

Product Version: UE 4.18
Tags:
bp-question.png (153.4 kB)
more ▼

asked Oct 31 '17 at 03:05 PM in Blueprint Scripting

avatar image

SSC_RED_DRAGON
5 3 3 3

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

2 answers: sort voted first

In case what Dune suggested does not work for you, consider the following:

alt text

capture.png (33.6 kB)
more ▼

answered Oct 31 '17 at 08:26 PM

avatar image

Everynone
13.8k 74 25 58

avatar image SSC_RED_DRAGON Nov 01 '17 at 01:36 PM

Thanl you that worked perfectly. Sorry if there was any confusion on what I was asking.

avatar image Everynone Nov 01 '17 at 04:31 PM

That's great, consider flagging this answer as accepted if it's working as expected.

avatar image DesertEagle_PWN Nov 01 '17 at 04:49 PM

Take what Everynone suggested. The resulting normalized vector (before the 20000 scale) provided gives you the direction of the dash. You can scale this by however far you want your dash to be in order to get a vector representing the offset which can be added to an AddWorldOffset or can be used in calculating a new transform/ world location for SetActorWorldTransform.

avatar image DesertEagle_PWN Nov 01 '17 at 04:51 PM

One Caveat. This assumes that your player character is actually a Character with a CharacterMovementComponent and not just a pawn, since GetVelocity is only valid for simulating physics bodies or for actors with defined movement components.

avatar image Everynone Nov 01 '17 at 05:35 PM

There is something called GetLastInputMovementVector in the Pawn, I think it can be used for this, too.

I mean, you can always store your position from .1s ago, and get directional vector by comparing it to your current position.

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

Instead of using the Camera forward vector, use the Actors forward vector or forward vector of the character.

more ▼

answered Oct 31 '17 at 03:29 PM

avatar image

Dune
1.9k 52 40 200

avatar image Everynone Oct 31 '17 at 08:10 PM

That would move the actor along the forward vector rather than in the direction they're currently moving. As in, you're strafing to the left but looking ahead, dash should move you where you're strafing, not where you're looking.

I think that's what @SSC_RED_DRAGON wants, no? Sounds a bit unclear to me.

(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