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"

Top Down Strafe to Mouse Location

Hello All

I'm brand new to UE4, and reading up on tutorials and the likes to help myself learn the blueprint system.

What I am trying to achieve is a top down WASD movement system, but with the mouse used as an aiming point.

So far I've got the rotation sorted out, it points to where the mouse is, and W & S goes forward and back to where the mouse is pointing on the screen.

The problem I'm having now is with strafing.

I can get it to strafe on the Y axis with no problem... but say if the character is moving forward on the Y axis, and I press "A" to strafe left... he will just continue going in that direction.

So ultimately I need help with strafing, so that the character will move side to side based on where the location of the mouse is on the screen.

Here is what I have so far (sorry for the mess, really I'm new to this). alt text

Appreciate the help!

Product Version: UE 4.10
Tags:
movement.png (195.9 kB)
more ▼

asked Mar 06 '16 at 08:56 AM in Blueprint Scripting

avatar image

Flappers
13 3 4 5

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

2 answers: sort voted first

If you have a valid forward vector then getting the right/strafe vector is pretty simple. Try just using a "Rotate Vector" node based on your forward vector.

alt text

capture.png (13.1 kB)
more ▼

answered Mar 07 '16 at 05:15 PM

avatar image

RimmyD
2.6k 98 16 97

avatar image Flappers Apr 03 '16 at 02:30 PM

I know it's been a while since this was written, but wanted to say thanks, as this pretty much did the trick!

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

You have to set a proper value for "World Direction" on the RightMovement. This gonna be the vector you are using for the forward input, just rotated 90 degrees to the right.

more ▼

answered Mar 06 '16 at 07:05 PM

avatar image

Ryan Darcey
836 47 45 70

avatar image Flappers Mar 06 '16 at 07:18 PM

Thank you for the answer. Do you have an example in blueprint that I can refer to?

Thanks

avatar image Ryan Darcey Mar 06 '16 at 07:20 PM
avatar image Flappers Mar 06 '16 at 08:41 PM

Thanks, I got a bit further, but just can't seem to get the angles right.

I tried placing the current mouse location as the vector, and added +90 on Y in axis, but it was a bit strange. Tried also feeding off the forward movement into the vector on this node, and adjusted the Y axis, but it just keeps going forwards and backwards, instead of side to side.

(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