Hi again,
In the past week I managed to not only get the sway looking the way I want it to but also adding a “free aim” offset type of aiming featured in games like Red Orchestra 2 and Insurgency Sandstorm that’s looking really nice!
However, I’m starting to work on aiming down the sights now and running into some issues. I’m currently trying to move the camera position to a socket on the shotgun that’s placed at the rear sight area. I’m following the example shown in post #12 of this thread from one of the devs on the game Ground Branch. Its just some simple math to keep the camera lined up with the socket (my testing blueprint for this looks exactly like the pastebin blueprint link in that post), but there’s a problem where it doesn’t follow the X position of the socket no matter what its offset is. This results in the camera getting offset from the socket at the X position as the gun moves to the left and right when looking down because of the way the aim offset animations move the gun’s X location. Here’s what that issue looks like (ignore the weird rotation at the start, that’s because I was tabbed out). I know the issue isn’t caused by the free aim system because its toggled off in that example gif.
With this in mind I’m thinking the solution you suggested (using the hand bones themselves to position the gun correctly) might be the optimal way to achieve aim down sights with my implementation since it would be moving the actual bone to the center, bypassing this issue altogether. However, I’m still having a lot of trouble understanding what you mean about solving the distance on the forward vector and then offsetting it downwards to where the iron sight is located, as well as where this code should be done (Anim blueprint event graph, character blueprint, etc).
From my understanding what you were suggesting means:
- Let the Root Yaw Offset equal the center of the camera, or the position we want to move the hand bone to in a lerp (Position B)
- Get the forward vector of either the hand or the camera center; this is what I’m confused about the most
- Add a number that moves the camera down a bit to line up with the sights, or the sight offset
- The forward vector combined with the sight offset is the position we want to move from in a Lerp (Position A)
If you could help clarify this I’d greatly appreciate it. Again, I can’t stress enough how helpful and informative you’ve been, sorry if these questions feel really newbie lol. I’ll be continually tinkering with this for a while so it may be likely that I figure it out, but one of the biggest lessons I’ve learned in my time as a dev is that it never hurts to ask questions so I figured I’d post about it. Thanks again!