Camera System

Hello guys,

I am trying to recreate the camera system from an older PS2 game. I can’t seem to figure it out.
If anyone has any advice please share.

I have uploaded a video explaining

Thanks for your time!

Make the camera a child of the player. Use LookAt on the camera and set the target to the player.

That should get you headed in the right direction.

Thanks for the reply,
I’ve actually managed to recreate this,
and its a hell of a lot more complicated than just adding a camera as a child of the player and using look at.

Theres a simplistic depth to this that doesnt look complex at first glance.
The players movements are always based on the cameras forward, and the camera chases the player and tilts while holding “left” will run him in a circle in what feels like “around the camera”
Its a pretty cool thing.

For those looking to do something similar. You child the camera to a cube, and child that cube to the player. You then rotate that cube to rotate the camera.

In a script when reading input you must get your input vector, and camera direction.
Find the angle of input by trig/vector math then create a 4x4 rotation matrix.
create a movement direction by using multiply vector on the normalized camera direction found.
Then calculate the facing angle again off of the movement direction.
finally apply this angle as a new vector3 with the x and z zerod out for your euler angles.
Then the trick to making the camera chase you is to rotate the camera target if the abs value of ur horizontal read is above a threshold (i chose 0.01f), you add this to your MouseX.
Which creates this effect where your camera driving the character movement

hi are you using the new input system?
If you could, can you share your script??

Hey idk what the new input system is but here u go:

        if (!isAttacking)
        {
            // Input direction
            float hori = Input.GetAxis("Horizontal");
            float vert = Input.GetAxis("Vertical");
            Vector3 inputVector = new Vector3(hori, 0.0f, vert);
            Debug.DrawRay(transform.position, inputVector * 2, Color.red);

            // Camera direction
            Vector3 cameraDirection = cameraTarget.position - myCamera.position;
            cameraDirection.y = 0.0f; // we dont want up/down dir
                                      //Vector3 option2= mainCamera.forward; //zero out
            Debug.DrawRay(transform.position, cameraDirection.normalized * 2.0f, Color.green);

            // Movement angle
            inputVector = inputVector.normalized;
            float angle = Mathf.Atan2(inputVector.x, inputVector.z) / Mathf.PI * 180.0f;
            Matrix4x4 rotation = Matrix4x4.Rotate(Quaternion.Euler(0f, angle, 0f));

            // Camera offset by input
            Vector3 movementDirection = rotation.MultiplyVector(cameraDirection.normalized);
            Debug.DrawRay(transform.position, movementDirection.normalized * 2.0f, Color.blue);

            if ( (Mathf.Abs(hori) > 1e-5 || Mathf.Abs(vert) > 1e-5) && !isAttacking)
            {
                float facingAngle = Mathf.Atan2(movementDirection.x, movementDirection.z) / Mathf.PI * 180f;
                transform.eulerAngles = new Vector3(0.0f, facingAngle, 0.0f);
                _animator.SetBool("isMoving", true);

                //Angle Camera - unused , now handled in cam script
                // cameraTarget.transform.Rotate(0, hori * 0.2f, 0);

                return;

            }

        }
        _animator.SetBool("isMoving", false);

thanks!