Questions on Unity3D
, as far as I see quite rare, I am afraid to get a lot of drawbacks, but there is a question.
How to implement the rotation of the camera around the object, but at the same time, that would be when you move the object, the camera went behind the object.
The picture shows a camera and a ball.
There are CameraController and PlayerController.
There is a rotation of the camera.
transform.RotateAround(playerGO.transform.position, new Vector3(0, 1, 0), 1*Time.deltaTime);
And the movement of the ball itself
movement += Input.GetAxis("Horizontal") * cameraCtrl.SideDirection; movement += Input.GetAxis("Vertical") * cameraCtrl.ForwardDirection; rigid.AddForce(movement*speed); movement = Vector3.zero;
The problem is that when the ball changes position, the camera simply rotates further around the ball, but the ball can go beyond the limits of the camera's visibility and it will rotate further, how to fix it?