Freeze Camera when Player is found

Security Camera part 2

Watch the Camera cone that finds the player stops moving

In this article we will stop the camera from moving when the player is found from code.

To achieve this effect we will simply disable the animator when the player is found.

Stop Camera movement on Player Detection Code

A handle to the animator is needed and only when the player is detection the animator should be disabled.

[SerializeField] private Animator _animator;private void OnTriggerEnter(Collider other)
{
_animator.enabled = false;
StartCoroutine(StartGameOverCutscene());
}
Same clip as above but the Game view

--

--

--

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

FlutterForce — #Week 160

Easy Filters - Intro to GPU Pixel Shaders

Ansible: Configuring docker and setting up HTTPD server inside docker container using ansible…

Learning Go — Part 4

Publishing Storybooks

How to Add Divider Between Each Line with Different Methods

Udacity, where the positive energy raises

Property-based testing

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

Your multiplayer game will fail because…

How to Install the Universal Render Pipeline

Quick tip — Upgrading your Unity project to Universal Render Pipeline (URP)

What is Filebase and How do you use it?