Fixed Angles Camera System Part 1

Switching between camera angles based on player movement

In this article we will make the camera switch angles depending on where our player is moving.

Added some particles for visibility

Camera Switch Triggers

Here are our Camera switch triggers (box colliders, Is Trigger checked). When the Player passes through them we want to change the Main Camera position to another fixed position.

Make sure to have a collider and a rigidbody component on your Player and Is Trigger s checked.

Player components

This will allow us to detect if our Player has moved through a certain point on the map.

CameraTrigger Script

We put this script on each of our camera triggers. Then we assigned a empty game object that contains the position and rotation of our camera angles to each.

//handle
[SerializeField] private GameObject _targetCamera;

private void OnTriggerEnter(Collider other)
{
if (other.tag == "Player")
{
Camera.main.transform.position = _targetCamera.transform.position;
Camera.main.transform.rotation = _targetCamera.transform.rotation;
}
}

Result

The Player is sometimes poorly visibly, so that’s something to work on next.

--

--

--

Aspiring developer that’s self-learning Unity & C# to transition to a career with Unity. I got a passion for creating interactive experiences.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

What i learn? “Testing on React.Js”

Add Charts into Our React App with Nivo — Sankey Diagram

Create and publish your first npm package on Github repository

Your nice own package

Learning JavaScript by Implementing Lodash Methods — Converting Objects

Framer Cheat Sheet: Scroll Components

What is state?

Some Basic tricks to solve problem-solving in JavaScript

Nx + React Native Web + Docker

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Tristan Engel

Tristan Engel

Aspiring developer that’s self-learning Unity & C# to transition to a career with Unity. I got a passion for creating interactive experiences.

More from Medium

Journal 143 — Unity Project Development, 2.5D Shooter

Creating enemy movement behavior

2D Mobile: Designing Enemies Using Abstract Classes

Building a Modular Music Switching System