- Home /
Camera Shake Problem When Player Scaling Up and Down
I want my player to have a bit of animation when he jump so i try to scale player down in y axis when he jump. My player is just a block of square. The camera is child of the player in editor hierarchy. It looks fine when its x,y position is (0, 0). I change the camera position to (0, 1) so the player can see more what is there in the top but the camera shakes when the player do the jump animation (scaling up and down).
Here is the demo, please test it.
Below is my jump and scaling code:
else if ((Input.GetKeyDown(KeyCode.UpArrow) || jump) && canDoubleJump) {
rb.velocity = new Vector2 (rb.velocity.x, jumpHeight);
jump = false;
canDoubleJump = false;
transform.localScale = new Vector3 (transform.localScale.x, playerInitialY - 0.2f, transform.localScale.z);
}
if (rb.velocity.y < 0) {
transform.localScale = new Vector3 (transform.localScale.x, playerInitialY, transform.localScale.z);
}
Comment
Your answer
Follow this Question
Related Questions
Enabeling components 1 Answer
Unity 5.2 camera not recognised 1 Answer
RenderTexture.Create failed: format unsupported 0 Answers
I cannot see button on camera preview 1 Answer
Scope Zoom Sensitivity 0 Answers