3rd Person Controller Using Cinemachine Virtual Camera On Mobile

Going to share the approach I’m using in having a 3rd person controller using Cinemachine Virtual Camera controlling it using mobile Input.

YouTube: https://youtu.be/88855QY4CXk

GitHub: https://github.com/rehtse-studio/Cinemachine_MobileInput

Starter Assets — Third Person Character Controller: https://assetstore.unity.com/packages/essentials/starter-assets-third-person-character-controller-196526

What do we have on this project?

On the Hierarchy I have a the Player GameObject called PlayerWithVirtualCamera, on it you will find components like the Animator, SphereCollider and a Rigidbody; it is also hold the script called PlayerControllerWithVirtualCamera . I also have the PlayerInput component that will allows me to use the Input Actions called VCamera3rdPersonInputActions from Unity’s New Input System.

The VirtualCamera_UI GameObject hold two UI Canvas: UI_Standard and UI_Mobile

UI_Standard canvas hold the buttons to make the effect that I’m turning the Mobile Input ON or OFF.

UI_Mobile canvas has the necessary UI GameObject that hold the Mobile Input logics. A UI Panel called LookTouchPanel hold the script UITouchPanel that will create the necessary value X and Y to control the camera on mobile.

A UI Image called JoystickContainer has a script that create the X and Y value to move the player, the script is called UIVirtualJoystick

There is another UI Image named RunAction that has the On-ScreenButton script from the new Input System and it will behave like a GamePad LeftTrigger establish by the Control Path.

Inside the players GameObject I’m holding the Cinemachine Virtual Camera and a empty GameObject CameraTargetObject. The CameraTargetObject is the LookAt and the Follow of the CinemachineVirtualCamera that will allow me from the script to rotate; this empty game object is near the chest area of the player.



On the script I have the necessary variables and reference to control my player and to get the inputs from the virtual joystick, the touch panel and from the new Input System.


  • NOTE: The logic for the Joystick was studying using Unity’s New Asset that has different mobile environment for Input*


At the beginning of the article you have links for the Unity project and the video from YouTube.

Hope it helps.

To be continued 😎




Game Developer sharing content around Unity, programing and tips and tricks in game dev.

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

Recommended from Medium

#100DaysofSQL | DAY 17: Window Functions are not scary!

No Agile or Do Agile or Be Agile

Looking forward to 2018!

Doodle Insights #20: The Twisting 4-Sided Column Effect

Challenges with PWA iOS 13 — From The Developer’s Perspective

Challenges with PWA iOS 13 — From The Developer’s Perspective Blog Banner

Why use MongoDB?

Food for Agile Thought #122

STM32 Guide: GPIO and Buttons

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
Esther Felicies

Esther Felicies

Game Developer sharing content around Unity, programing and tips and tricks in game dev.

More from Medium

2D Mobile Game: Player Movement

Mobile Game Progression

A 2D Game Retrospective

Adding a User Interface to our prototype