I’m currently working on an FPS game. I imported this character model from the AssetStore to experiment with it:
So far I set it up that the character’s y-Rotation follows the x-movement of the mouse. → Moving the mouse to the left/right will rotate the whole character to the left/right. Additionally, the character uses a default idle animation: 3
Like in any other game I would now like to make the weapon follow the cameras x-rotation → If I move the mouse up/down the camera moves up/down, too and the weapon should follow the cameras movement.
However, I noticed that
- if I use
weapon.transform.position = ...the weapon does change its position but doesn’t continue the idle animation. Why?
- if I use
weapon.transform.RotateAround(camera.transform, Vector3.up, 30 * Time.deltaTime)(example from docs) it doesn’t rotate the weapon either but only sort of moves it a bit but then “glitches” it immediately back to its original position: 5
How can I make the weapon’s rotation follow the cameras x-rotation (mouse up/down) and still continue the idle animation like shown in the first video?
Thanks for any help!