How Can I Make Mouse Shoot for Top-Down?

Hello. I am making a top-down game, it needs to work like ARPGs (Diablo, Path of Exile etc.). I made my character movement on W,A,S,D. I need the character to shoot when Left Mouse Button is hit. Like here: Top Down Shooter (Isometric Camera, WASD Controls, Aim at Mouse Cursor, Alien Swarm) - YouTube

This is not blueprint, so I can’t use it.

And I tried this, it didn’t work.

Your projectile spawn location does not take the characters rotation into account X=>100 based on player location is always “East” of the character no matter what way he is facing, but that’s the only issue I can see with the BP, what exactly “does not work” when your function is called?

I got this blueprint from this video which is the only answer for the problem on the internet: Blueprints - Shooting Projectiles At Mouse Location - Unreal Engine 4 - YouTube

Yes projectile only respawns at east of the character, no matter where I put mouse or which direction character is looking. That’s what I meant for “does not work”.

Can you help?

That’s how I did it a while ago basically you need to setup a proper point of origin, for me it was the weapons world location, it made the most sense to me, you could also use sockets on hands though to shoot fireballs or something.

Although I do set my characters rotation to point toward the mouse cursor as well to “aim” in the right direction otherwise it might look strange, i do this seperately with an aim-stance but for something like diablo you would set actor rotation everytime the mouse is clicked together with handling the attack.

There is a crossbow on the character’s hand but how do i reference to that crossbow on other blueprint?

and when does that solve the problem or do I still need to figure out that actor rotation thing?

in controller call Get controlled Pawn, cast it to your characer blueprint and from there you can access any part of it such as your crossbow, then getting the world location of the mesh. this will fix the spawning location of your arrow but you can still shoot behind your character or sideways until you implement a character rotation towards the mouse.

the thing is; crossbow is in a Mixamo character’s skeletal mesh and I can’t get a reference to that mesh.

Add your own spawn point then
Add Component → Scene
Drag the Scene on your mesh to Parent it
In the details of the scenepoint Select ParentSocket and select wichever bone the weapon is on (right hand propably)
now you just position it in the viewport to where your arrow should spawn.
You should rename the Scene, now when you cast the character pawn in any other blueprint you should be able to get a reference to this scene point and call world location on it.

I did this:

Just ‘torch’, instead of ‘crossbow’. I chose Health Pick up as projectile, but it spawns on me, not in front of me.

Can anyone help me please? I just want character to shoot where the mouse is, please…

The only thing I see wrong with this BP is that your projectile is not spawned at the right location,try fixing it like this

Thank you for your answer. I did this but it almost respawns at the same location, no matter where the character is and its not like character is shooting, projectile just spawns not go through.

I don’t care about the second part anymore, just want it to spawn where I hit the mouse.

can anyone solve this?

Man, this worked after I change the projectile with the one in FirstPerson Template of UE4. Thank you so much!
The last thing is, when the mouse button is hit, character needs to change his direction to that location. What should I add to do that?

Take a look at SetControlRotation

It’s all good now. Thank you so much!