- Home /
How to move the rotation of the X and Z axis of a 3D model's head with Mouse Input?
Background Information:
Hello, I have been struggling with figuring this problem. In essence, I am trying to create a first person camera setup. Specifically, I am trying to figure out how to have it so when I move my mouse horizontally (on the x-axis) it moves my character's head side to side. In addition, I am also trying to have it so when I move my mouse up and down (on the y-axis) it moves my character's head up and down. Thus, to start I followed a tutorial on youtube to create the script which moves the character either side to side or up and down.
I have downloaded the "Adam Character Pack" and am currently using the Lu model. The initial problem that I had was the that the Lu's neck transform had a transform orientation that did not have a proper orientation.
Thus, the script that I used for the tutorial did not work. I ended up attached the mouselook script to the actual "NeckA_MoCap_M" bone/part of Lu's model. I was able to get the x-axis to work and turn the model side to side. However, I haven't been able to figure out how to get the Mouse Input Y to move the Z-axis located on the Transform component under the 'Rotation" row (that is what actually turn's Lu's head up and down) In addition, I have put the camera as a child to the "NeckA_MoCap_M" bone/part of Lu's model.
What I have done so far:
In this picture below here is the original script from Holistic3d's youtube tutorial
**What I am struggling with:
I haven't been able to figure out how to adapt the script to make it so that the when the player moves the mouse side to side the character's head moves side to side and when the player moves moves the mouse up and down, the character's head moves up and down. I am more looking to be pointed towards the right direction or what I am doing wrong, so I can improve and fix the problem. Thank you for your time and consideration. Lastly, if you need to post more clarification or more information, just let me know.