Hello everyone.
I’m developing a top down shooter and I have a major problem with aim offset which I tried to solve for three days without any success. I also tried to look it up on the forum but couldn’t find anything related.
So, the issue is that FindRelativeLookAtRotation goes crazy when the character is near the wall or aiming at the ground level.
What I do to calculate pitch for the AO is that I take the location of the object under the cursor as a target location, for starter location I use the muzzle socket of my weapon and apply it to forementioned function. Most of the time it gives proper result, but the problems start, like I said, near the walls. The pitch value jumps rapidly from, for example, -60 to 60 resulting in very weird character animation.
I tried setting AO anim sequences to additive, but that didn’t work.
The gun doesn’t have any collision when is equipped.
You can see the values of the pitch on the uploaded video. Watch 2024-04-29 15-54-03 | Streamable
Thanks from the advance!
Hello! I’m here to help you with your problem with aim offset in your top-down shooter game. It sounds like you’re having trouble with the FindRelativeLookAtRotation function when the character is near walls or aiming at the ground level.
One possible solution to this issue is to adjust the pitch value for the aim offset. Instead of using the location of the object under the cursor as the target location, you could try using the location of the object that the player is aiming at. This should help to reduce the rapid pitch value jumps that you’re experiencing.
Another possible solution is to adjust the additive settings for the aim offset anim sequences. You could try setting the anim sequences to be additive instead of using the default settings. This should help to ensure that the animations are properly synchronized with the player’s movement and aiming.
It’s also worth noting that the gun in your game doesn’t have any collision when it’s equipped. This could be causing issues with the aim offset, as the gun’s position and orientation may not be accurately tracked. You may want to consider adding collision to the gun to help ensure that its position and orientation are properly tracked.
I hope these suggestions are helpful!
I’m sorry and dont wanna be rude, but that’s clearly a CHAT GPT answer. I already covered 2/3 things from your list in my original post, like additive animations or collisions. Chat GPT gives too generic answers, I need human insight into my problem.
You could use regular “find look at rotation” instead of relative one.get rotation Y for the pitch.
Here is a topic discussing similar thing.
I tried to do that already, and just double checked - the result is the same
try clamping the float too, you wouldnt want them too aim too high/low anyway but also if it hits 180 it may try to wrap around
Baobao solution worked, but now the aim offset is based on player’s transform, which doesn’t really match actual weapon pitch.
So, the issue seems kinda to be solved, but if anyone is down to investigate why aim offset based on the weapon socket was so buggy and why the socket changed it’s transform so rapidly, I’d be very happy.