2d side scroller shooting with mouse

Hi Guys, I am trying to implement a shooting mechanic in my 2d side scroller game. with the Paper2d plugin

I put a scene in my character blueprint at where the gun is, so the bullet can spawn

the shooting function works, by itself, the bullets are able to spawn when I fire.

my projectile is like this:

when I shoot

I then wanted to add an aiming function so the bullet would shoot at where my mouse was.

I do that by making a custom event, and finding bullet scene world location first, then i use player controller convert its mouse location to world space.

I used find look at rotating, using bullet scene world location for a start, and world location mouse for the target.

I plug the return value to set world rotation for my bullet when I fire the gun.

the bullet doesn’t seem to follow the mouse at all.

I tried to 0 all the transformations from the bullet spawn location, and it worked

but I really want to have the bullet spawn at gunpoint, is there something I did wrong?

Thanks in advance!

To get the mouse location id recommend “get hit result under cursor by channel” under the player controller, the node your using I believe is intended more for widget functionality

Thank you

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.