- Home /
Camera rotate and move follow Player
I make a 2d game with characters moving around the earth. I wanted the camera to move and rotate the camera follow the character But move very jerky (if I increase the value of the parameter 3rd) and rotate the camera does not keep up the character (if I reduce the parameter value 3rd) Sorry my bad English Help me fix that
void FixedUpdate ()
{
if (gc.gameState == GameController.GameState.playing || gc.gameState == GameController.GameState.changeWave) {
transform.position = new Vector3 (player.transform.position.x, player.transform.position.y, transform.position.z);
transform.rotation = Quaternion.Slerp (transform.rotation,
player.transform.rotation, 5 * Time.deltaTime);
}
}
is it a top view because you could make the camera a child of the character
Answer by b1gry4n · Sep 01, 2016 at 02:03 AM
FixedUpdate is usually used for physics calculations, so it isnt updated as frequently as Update. If you need to use fixed update, you should use Vector3.Lerp, otherwise just put what you have in to Update
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Can someone help me with my question with IENumerators in C#? 1 Answer
My 2D ball keep falling through ground 1 Answer
My 2D ball keep falling through ground 0 Answers
2D C# destroy a GameObject on collision 2 Answers