Download

2D Shooter BP Problem Shooting at location

Hello everyone!
Hope some one out there can help me with my problem.

Im trying to make a 2D Shooter with the mouse as aim cursor.
I started with a new 2D project with the Unreal starter content. I made my own mouse cursor BP that works fine.
Now i need to get the character arm/wepon to follow the mouse cursor and shoot projectiles at mouse location.

This is what Ive used so far to get to this point.

Mouse Cursor BP
Material Scope BP

And I have tryed to make allot of variation of BP’s to get to shooting to work but nothing working.
I add some Photos of my not working BP’s of the shooting at mouse location from character location.

Do enyone know how to make this work?
I been looking in to get the mouse cursor that is built in unreal engine 4 to work instead of my own BP mouse cursor, but it seems no to work with the 2D template.

Thanks and Peace!

does the spawn work at all? (Btw, what’s the 2D project template? is it the 4.3 preview 2D Side Scroller, or just Side SCroller?)
Try do simple things first, like click and spawn your wall_sconce at specific location. (say at 100, 0, 0)
After make sure spawn works, then try print out the location you get by hit location, and then pass the info to spawner.

btw, your bp attach 4 will never work because it requires both touch and mouse click.
(specifically, it requires left mouse button pressed once, and then use touch input as source. )

Oh sorry for that. I just marked the wrong Actor in Spawn actor…
The Actor is a bullet, just a sphere that i made.
Good that you saw this, but my problem is not placing them ingame.

It is to actually shoot my bullets at my mouse location in the BluePrint Side Scroller template or what you call it.
Hope you get what im saying.

Hello,

Here is my blueprint for rotating towards an aimpoint(right now I hooked up the controllers right stick to horizontal and vertical, but the function is right there, Convert Mouse Location to World Space, use its World Location to find look at rotation)

When I press Fire Projectile Input button I call the FireProjectile which I included a image of.

Hope its clear enough.

Thanks!
I will try this!
This is all done in MyCharacter BluePrint right?

That Fire Projectile in purple color, how did you do or make that?

When I do as you have done mine just dropps small balls from the (Arm Gun) Location on my character that I added.

Hi Psylo,

if you select “New Function” in the blueprint graph it will create a separate function graph. Piddaun has taken advantage of this to allow him to set his fire projectile in a new function (the purple node) and call it within the event graph. It is a good way to keep your blueprints organized!

What I did was do a raycast to the background wall and make it pretty close to the player, then have x always be multiplied by 0, and keep the values of z and y. Then I took the mouse position from the raycast and had the arm find look at rotation to it.

Okay, I ‘‘think’’ i get it.
Im so new to this stuff. So glad you ppl are out there to lend a helping hand!

But then what BP do I need to get the bullet to fly to my mouse?
Do I need to remake the mouse cursor that I use?

(I tried to take the BP from the first person bullet Blue Print but still nothing).

If some one got this to work and be so kind to upload the BP’s here that wold be sooo great!

Thanks!

I’d really recommend you throw in a bunch of Print String messages just to confirm it’s actually even going through the entire process, I know some people would say to watch the simulation of the BP itself but its up to you.

If you want a few places to throw them I’d put them at;
Left Mouse Button Press > “Input from LMB” > Back to original
@ The Fire Projectile have it right after before spawn actor and have the string be like; "Fire Projectile called @ " + Location

Also you should really be using that New Function for anything that you’d want to customize or reuse easily. Also I’ll link to you a video series that will teach you the basics since you’ll might be thinking about making this a co-op game and it also has a sort of projectile spawning(bombs) that you’ll be able to see. He also covers most of the basics of UE4 about changing meshes on impact, etc.

(The first two videos of him just talking about the general networking, you’ll learn how to do stuff @ episode 3-4-5)