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"

How to allow a 3rd person character to face where the mouse is aiming.

Id like to have a character walk forward, backwards and strafe sideways whilst the mouse pointer dictates what direction the character is facing.

Product Version: Not Selected
Tags:
more ▼

asked Mar 22 '14 at 02:32 PM in Blueprint Scripting

avatar image

Denjino
31 1 4 5

avatar image Denjino Mar 22 '14 at 04:10 PM

Thank you so much guys. I tried Alexander's solution first and that worked perfectly, all id need now is to create the strafe and walk backwards animations. Thank you ParralexLLC, ill try your solution too later.

avatar image ParralexLLC Mar 22 '14 at 04:12 PM

Not a problem! If I need to clarify anything in my Blueprint I'll be happy to assist you.

avatar image Gender_Bender Jun 27 '14 at 12:42 AM

Hi I was wondering how you got the Strafe InputAxis to work? I was trying this out and got the character to look at and follow the mouse with W, but am having problem with strafing around. Any help would be much appreciated

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

7 answers: sort voted first

Simply put your character as the Target for "Get Actor Location" and "Set Actor Rotation" and it will look at wherever your mouse is! I tested this as well to make sure it works. Picture

If you don't want debug lines to draw, then change the "Draw Debug Type" under "Single Line Trace for Objects" to "None". As well, this Blueprint will only look at Static geometry (BSP brushes, etc.), so you may want to add more types to the "Make Array" node. Just click "Add pin" and select all of the things that you want to look at from the drop-down.

schedule.png (131.0 kB)
more ▼

answered Mar 22 '14 at 04:06 PM

avatar image

ParralexLLC
319 5 12 21

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

Thanks so much! BUT... with my top down shooter game (WASD to move north, south, east, west) I needed the player to always face where the mouse was. This blueprint Parralex provided was a great solution! I had to add one more thing... a Break Rot and a Make Rot. This is because with the character would become inverted when mousing over tall objects. SOOOOO, Here is what I did to fix this! Hope it helps someone!alt text

added_breakrot.jpg (62.6 kB)
more ▼

answered Mar 22 '14 at 06:39 PM

avatar image

CT Deception
141 2 7 15

avatar image ParralexLLC Mar 22 '14 at 07:04 PM

For future readers, the additions that he made (Break Rot and Make Rot) are isolating the Yaw, which is the angle on the X,Y plane (Pitch is for the Z plane, while Roll is not used). This makes sure that the character is looking parallel to the ground, while keeping the surface direction intact. This is perfect for Top-Down Shooters. For a Sidescroller, you would want to isolate the Pitch, although you would need to figure out the Yaw for the direction that you want to face (left or right).

Thank you Zortalas for your contribution, I'm sure it will be helpful to someone!

avatar image Kuhnen Apr 18 '14 at 03:05 PM

Hey. I tried the solution for top down view... If I'm using the "top-down blueprint" template, I should put that blueprint in the MyCharacter actor, right?

I did it and the character keeps looking to a fixed point in my level, not where the mouse is. :(

I'm attaching a screenshot of my graph. If anyone could point me at the right direction, I would appreciate it!

Thanks!alt text

lookatmouse.png (240.9 kB)
avatar image Kuhnen Apr 18 '14 at 03:06 PM

nevermind. found my mistake... the multiplier to the World Direction was set to 0. :P

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

Hi Denjino,

If you simply what the character to face the direction in which the mouse is pointing, take a look at the 3rd Person Blueprint Template and under the Blueprints folder for My Character, go to the Defaults tab and search for Pawn. Check the User Controller Rotation Yaw option and that will allow the pawn to face the direction the mouse is pointing.

Note: The character in this example doesn't animate and rotate towards the camera, there would be a little more involved in this.

Hope this helps points you in the right direction (yes pun intended)!

-W

more ▼

answered Mar 25 '14 at 10:32 PM

avatar image

DizzyWes ♦♦ STAFF
5k 145 64 206

avatar image darkhemic Mar 28 '14 at 07:13 PM

Thank you Wes for this simple solution using Blueprint. I cross posted your answer under my question about creating a 3rd person shooter perspective like Gears of War. It's one step closer to what many of us are trying to create without c++ coding.

(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