In my case, the angle of horizontal rotation of the machine gun becomes greater by the angle of rotation of the turret of the tank. In simple terms, why don’t the two angles line up? How can this be fixed?
I would be grateful for any help in solving this problem.
Thank you for the advice! I’m still figuring this out, so it would be helpful to understand the best way to synchronize the rotation in my case. If you have any materials, videos, or articles that could help, I’d really appreciate it!
Just try implementing my suggestion! If your objective is to have the same yaw for your turret and machine gun, you can simply use the same value to set their rotation! You’re already interpolating “Turret Yaw”, you shouldn’t do it again for “MGYaw”, having a value that’s also being interpolated as the target this time. (Not saying you don’t need to, you SHOULDN’T in this case) Your machine gun will already rotate smoothly when you constantly set it’s rotation to your existing variable the same way you set the turret’s rotation.
Hope this clears things up
Hmmm… Maybe there’s a reason you have separate variables for them. Is your objective to smoothly rotate the machine gun until it reaches the same target yaw as the turret, but slower? If so, you can also use a Finterp node and plug the same value to the target pin just like you did to interpolate “Turret Yaw” (you plugged “Turret Yaw” into there while it should have been the same value), then plug “MGYaw” into the current pin (you did that correctly), and make the interp speed something slower than the previous interp. (you currently have 0 there)
Additionally, you can safely avoid using variables here, as you can get the rotation of the components (or anything else) and plug them into the current pins of your Finterp nodes. Because you’re already setting the outputs of your Finterp nodes to set their rotations (not shown in the image you provided but should be somewhere), so their rotations do get updated.
The truth is, I immediately attempted to implement your suggestion, but it did not yield the desired outcome. Additionally, I tried, following your advice, to substitute the MGYaw value in the AnimGraph with the TurretYaw, but this also did not produce any results.
Now I see why you handle this inside the anim BP and use variables to store the yaw rots. Dunno why I couldn’t think of the possibility that they were bones.
I think the issue is that the orientation of those two bones are different. You can check from the SKM asset and see. In that case, you’d need to subtract 90 from your float type variable that represents yaw and then use the result for your machine gun