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"

Best MouseLook from TopDownShooter

I want to make a mouse look Top down view isometric shooter. I've got all of the projectiles, health, death and player failure states, but I have yet to get the movement and aiming to a state where i'm comfortable with. I need a mouselook that allows me to use a crosshair and shoot directly at it. The movement I want is to have pressing W move you towards the crosshair but i can't figure out how to make it do that. This is what I have so far It is driving me insane! Any help is greatly appreciated.

alt text

Product Version: UE 4.12
mouselook.png (192.7 kB)
more ▼

asked Jul 25 '16 at 07:23 PM in Blueprint Scripting

avatar image

3 2 3

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

1 answer: sort voted first

The convert mouse to world location returns where in the world you are clicking so doing a linetrace from there is meaningless.

Instead you can create a vector from your character towards that point by doing this: Direction vector = normalize(mousetoworldVector-characterlocationVector) set the forward vector to this new direction vector


calculate the angle between the two vectors and rotate that angle around the up vector as an axis.

more ▼

answered Jul 25 '16 at 07:32 PM

avatar image

2.7k 108 36 180

avatar image KittehBiscuit Jul 25 '16 at 07:40 PM

How would i make it draw the crosshair?

avatar image KittehBiscuit Jul 25 '16 at 08:01 PM

Could you show an example for me, please? As i'm still very new to Unreal Engine :(

avatar image NoobsDeSroobs Jul 25 '16 at 09:07 PM

Sorry, but I am not in front of a computer that has it installed. I am currently away from the office.

avatar image KittehBiscuit Jul 25 '16 at 09:12 PM

Could you organise it in a way with the text in this box that it would reflect the blueprint as i don't really understand what you mean

avatar image NoobsDeSroobs Jul 26 '16 at 07:45 AM

You know where in your world the user is. That is your PL vector. Then you get a vector from the node getWorldLocationFromMouseLocation that we call TL. The vector connecting those two points we can define by doing this: FromCharToTargetVector = TL - PL. This is basic vector math. If you dont know it, study the math.

Then, using this new vector that I will call FCTTV for short, you can ignore the z component by breaking the vector and remaking it by connexting the x and y components, leaving z as 0.0.

Now, using a node called normalize you connect the new FCTTV vector with the z component set to 0 and save this vector as NTV.

To get the angle you simply have to use the dot product node and attach the players forward vector and the NTV to this dot product node and you get the cosine value of the angle.

Finally, to do the rotation you need the angle itself so simply use the acos node on the value you just got from the dot product.

EDIT: Have a look at this link: Rotation

(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