Proper angle setup for shooting in a topdown game

Hi, simple question, can someone help me figure out a quick fix for this? My character basically shoots correctly for around 180 degrees and then when you try to try to go its other side with the cursor, to shoot there, it shoots correctly, just mirrored. When I connected a print node to the float value pitch it seemed to show the same value on both sides and Im not sure how to fix this.
vid of the issue here: 2022-11-21 21-25-15
pic of the BP: Screenshot by Lightshot

Hey @Smoku14! Welcome to the forums!

I don’t personally see anything wrong with this code… I was thinking you might have an absolute in there somehow. I can almost certainly tell you the issue lies elsewhere. Maybe in your projectile’s code? Maybe in your aiming?

Try to show us ANYTHING that might be important to this, the projectile is a good place to start, then the rest of the character BP.:slight_smile:

Hmm, first link is overview of basically everything I have in my project: 2022-11-22 21-05-00

This one is me hooking up a print to the pitch, as u can see its showing more or less the same pitch value no matter what direction Im looking at which makes me think it has to be something with the part of the script I showed earlier. 2022-11-22 21-07-40

any idea? or should i just dirty code a bit and add some IFs to make it work

Let’s try something!

When you move left, Set Rotation on the character Root 180 degrees on the Z axis.

When you move right, Set Rotation on the character Root 0 degrees on the Z axis.

Give that a try for sure.

Also, would you mind instead of printing location, printing the “Look at Rotation” vector and recording that?

after all I decided for a change of plans and just flipping the whole level to be sideways, and making my game properly topdown, with that I connected only the roll and yaw node to the transform and everything seems to work perfectly :slight_smile: THank you very much for your help either way :slight_smile:

1 Like