- Home /
Camera and character control
Hi, I'm creating a fps. I've been adding a script to my character that allows it to move and another that make my character turn in the X axis, all of this is fine.
Now my problem is that, when I add script to make the camera (attached to the body, in a way what in run-time you see the arm and the weapon (like in cod)) to turn in the Y axis, only the camera moves, and the character arms rest in the same position.
I don't know if I'm clear. When I turn my character to the right or left, all is good, but when it looks up or down, only the camera moves, not the arms. How could I fix that?
One solution could be to split the character in 2 parts: 1 the body and the other one the arms, but then I don't know how could I animate both body and arms.
ty
Answer by TanselAltinel · Nov 09, 2017 at 02:50 PM
Hi lluiscolom8,
Your problem here is hierarchy. When you move the character around X axis, whole character object rotates. Thus, every child object under character object rotates relatively.
However when then you move only camera and everything under only camera will rotate. So, you'll have to move your arms and weapons object under the camera, so they will rotate with camera too.
@TanselAltinel Hi man thanks for replying. $$anonymous$$ore or less I understood you, but my question is deeper. It's going to be an online game so other players should be able to see your character move relatively your actions. So if you aim up, the character arms should rotate up too, like in real life. How could I get this? $$anonymous$$aking animations of ai$$anonymous$$g top, ai$$anonymous$$g down...?
Are you using a full body animation ins$$anonymous$$d of just hands?
If so, you'll need to use I$$anonymous$$. There are a few solutions in the asset store like UFPS and Final I$$anonymous$$, you should check them out.
Yes, I have a full body that should be animated. For this reason I ask you:
Should I split my mesh into two parts: one for the body and another one for the arms, and animate them separately? By this way I suppose it will work.
If you have another method to make it, let me know.
Answer by Rugbug_Redfern · Nov 10, 2017 at 06:09 PM
Make the arms or anything you want to move with the camera a child of the camera. If you want to make it multiplayer compatible (with UNet) you can just add a network transform to the player's root and the transform and all it's children should sync.
Yes but the body and the arms are 1 thing, so I can't make only the arms move, because the body will follow the camera too. For this reason I ask you:
Should I split my mesh into two parts: one for the body and another one for the arms, and animate them separately? By this way I suppose it will work.
If you have another method to make it, let me know.
Your answer

Follow this Question
Related Questions
Add prefabs to hierarchy without game running? 1 Answer
Why is this happening? 0 Answers
Unity 5 Multiple Screen Space Overlay Canvas issue 0 Answers
GetKeyDown held for too long 1 Answer