DOUBLE ROOM QUEST: ‘Camera Movement Controls’ - Solutions

Quest: Double Room Quest
Challenge: Camera Movement Controls

Feel free to share your solutions, ideas and creations below. If you get stuck, you can find some ideas here for completing this challenge.

I simply added a zoom in button. It only zooms when you are pressing it. I found some more free effects on the asset store and used those for the “floor is lava” challenge.

2 Likes

I really like the ‘Hide Top’ feature. Not sure if this was intended but the explosion seems to happen twice when the player hits an obstacle. Goes once and then another time a few seconds later. Can’t quite remember the parameters of this challenge so maybe it was an instruction for the game?

No it was an accident. I swear I unchecked loop on the particle effect but maybe I didn’t.

1 Like

WIP

public class CameraControls : MonoBehaviour
{
    private Camera mainCamera;
    [SerializeField] private float zoomSpeed, rotateSpeed;

    // Start is called before the first frame update
    void Start()
    {
        mainCamera = GetComponent<Camera>();
    }

    // Update is called once per frame
    void Update()
    {
        ProccesCameraInput();
    }

    private void ProccesCameraInput()
    {
        if (Input.GetKey(KeyCode.E))
        {
            mainCamera.fieldOfView -= zoomSpeed * Time.deltaTime;
        }
        else if (Input.GetKey(KeyCode.Q))
        {
            mainCamera.fieldOfView += zoomSpeed * Time.deltaTime;
        }

        if (Input.GetKey(KeyCode.C))
        {
            mainCamera.transform.Rotate(Vector3.forward, rotateSpeed * Time.deltaTime);
        }

        else if (Input.GetKey(KeyCode.Z))
        {
            mainCamera.transform.Rotate(Vector3.forward, -rotateSpeed * Time.deltaTime);
        }
    }
}
2 Likes

I created a dolly track with a normalized path (you can see it in green):

And i move the camera along the path while looking at the center with this script:

I felt like i needed some kind of “locked” camera controller, and in this way i can show the player everything he needs while keeping the camera under control!

2 Likes

That’s a really cool idea. I like how it feels more specific than just generic camera movements (which is all I did :laughing:) and incorporates design! It would be more work in a full game, to do it for every level, but it’s a great way to add polish. Nice work! :+1:

1 Like

Privacy & Terms