In the process of creating a first-person game in three.js, I am aiming to incorporate movement in the gun when the player commands actions like walking or shooting. Despite being a novice in three.js and lacking knowledge on animation techniques using animationmixer, I have resorted to a basic approach. My current strategy involves adding a frames variable to the gun and incrementing it with each new game update. To simulate movement, I rely on using sine to alter the y-position of the gun and give it some visual dynamism.
While this technique suffices for simple animations, it falls short when dealing with more complex elements such as recoil effects or interactive item pickups. How can I effectively tackle these types of animations within the realm of three.js?