Gun Rotation Not Working Properly

The gun for the AI is supposed to point at the enemy but when it crosses the y-axis, the character is supposed to flip along with the gun. Most of the time, the gun and the characters orientation do not match, and enabling match orientation for the attacher would not work, because the character flips based on the guns y value. I have tried using an example I have found before, but eventually it stopped functioning properly. I tried another alternative by messing with the filters, but its still no use. Does anyone have a solution? My apologies if this sounds too complicated.

The topic got lost in the forums.

I think JR helped me with gun rotation before, you could try pinging him.

1 Like

You’re using “This X” in the gun to flip the sprite.
What you should try doing is using the point-at behavior to get the rotation of the gun and flip the sprite accordingly.

image

The expression is ((A%360)+360)%360 to get absolute angles.


Also its not perfect, but it’s a lot better than what you had before.
I would try to use a single proximity if you can and parent the enemies together,
then just shoot the closes enemy.

3 Likes

Thank you for the assistance, although, I am not entirely sure how to parent the enemies together with a single proximity. My apologies, I’m still not very good with behaviors. Also, I just noticed another issue that caused the flipping problem. The randomizer. I put the randomizer there so every now and then the AI teammates can miss shots instead of it just being all aimbot.

1 Like