- Home /
FPS: Make animated character weapon follow camera movement
Hello everyone,
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: Video
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: Video
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!
Answer by oyekashi555 · Aug 26, 2020 at 10:14 AM
You need to understand the animation rigging for thi. https://www.youtube.com/watch?v=fB0P0C_3sPU this might help you.,You need to understand the animation rigging for this... https://www.youtube.com/watch?v=fB0P0C_3sPU this might help you.
Your answer
![](https://koobas.hobune.stream/wayback/20220612224603im_/https://answers.unity.com/themes/thub/images/avi.jpg)