- Home /
First Person Character, Mecanim.
Hello fellow developers!
Today, I have a problem where I have made a First Person Character which has gone quite successful apart from the fact where I walk forward and then you can see his head.
PROBLEMS WITH THE PICTURES First is idle, looks good. Second is walking, you can see his head. Third is running, you can almost see all his body.
So as you can see from the diagrams, I do not want this to happen.
First, I have parented the camera on to the head, which is rather cool, but annoying after a minute of running, too shaky, etc. I attempted camera lerping, but I am not experienced in that field.
Please tell me your solutions.
Thanks,
Dimitri
Answer by DimitriUK · Jun 28, 2015 at 01:25 AM
For anyone who has a similar problem, I managed to figure it out on my own eventaully.
Parent the camera on the Rigidbody/Player, wherever the main parent is, do NOT parent it on the head of the 3D model.
You can see that the MainCam's posiiton is first in this Vector3.Lerp, and basically when I hold the Left Shift key, the boolean Running becomes TRUE, and that makes the Lerp begin.
If I did not explain this very well, please let me know.
if (Running == true) {
MainCam.transform.position = Vector3.Lerp (MainCam.transform.position, RunObj.transform.position, theTime);
}
if (Running == false) {
MainCam.transform.position = Vector3.Lerp (MainCam.transform.position, IdleObj.transform.position, sprintTime);
}
}
Your answer
Follow this Question
Related Questions
Move gameobject pivot 6 Answers
Use Lerp Position and Slerp Rotation together 0 Answers
Smoothly Rotate Character Y to Camera Y 2 Answers
Multiple Cars not working 1 Answer
MouseWheel Lerp Smoothing Problem 1 Answer