Cinemachine menu

Hey,

I have a 3d level where you control a fps player. When the game start, I would like to have set a small Virtual Camera showing part of the level from above with some text. This would represent a small menu before the actual game would start. After hitting any key level would switch to FPS player main camera and the game would begin. Is this possible to do this with Cinemachine?

I can not find any reference for any triggering. I thought I can do it with signals but I am not sure if it is what I am looking for. Any suggestions or solutions would be appreciated.

It sounds like you’re just talking about switching from one virtual camera to another, which is actually central to how cinemachine works.

The easiest ways to do this would be to set the virtual camera’s priority integer to be greater than any other virtual camera in the scene when you want it active, and then set it lower when you want the other cameras active.

You can also just disable the virtual camera game objects, as you would with most things in Unity.

Hi Alic, thank you for the reply.
Is this possible to program virtual camera with the UI of Cinemachine with setting some triggers or someting. Or does this need to be coded?

You will need to code a little bit. When the user hits the key, you will have to have some code that does something, for your game. Inside that something, add a line to activate the player camera game object.

Thank you Gregoryl, I will try this method.

I managed to do everything by your instructions and it works. Thank you.

But I encountered one more problem. I am switching between two virtual cameras, one is represents the “MENU” cam and second is attached to FPS player. When I hit the ENTER button and Menu camera transition to FPS virtual camera I am only able to move in X and Z axis during controlling the FPS player, Y axis is somehow locked. I am not able to look freely in all three dimensions. I tested around a little bit, and it is caused by attached Virtual Camera to the FPS player prefab. Do you have any suggestions why this is happening?

Can you show the inspector for your virtual camera? Also please show the hierarchy with the player, the vcam, and the main camera visible.

Here it goes. Screenshot of the inspector and hierarchy. Just to let you know I am using FPS player prefab from standard assets.

4774844--455051--hierarchy screenshot.PNG

Your problem is the hierarchy inside the FPS controller. You’ve got the Camera buried inside it. That won’t work with CM. Here is what you need to do:

  • Start with a clean FPS controller from standard assets
  • Find the Camera component, and disable it and the accompanying Audio Listener etc
  • On the object with the now-disabled Camera component, add a CinemachineVirtualCamera component using the Add Component dropdown in the inspector. Set the Aim and Body to Do Nothing
  • In your project root, create a brand new Camera. Parent it to nothing
  • Add a CinemachineBrain component to that new Camera

Then, it should all work. The idea is that the Camera is a separate thing, and its brain will sync it to the position of the highest-priority vcam that’s active in your scene.

Your solution looks elegant. But after trying it I discovered that it does not work, because FPS Controler asset uses a script which needs the Camera component. I tried to put CAMERA component to serialized field and link the new main camera. But it does not work. After hitting the play button the script kicks out the main camera from inspector and it is missed for other functions. I tried even to plug in virtual camera instead of the normal camera. But this does not work also.

That’s why you disable rather than remove the Camera component.
If I recall correctly, it’s possible to get the standard assets FPS controller to work with Cinemachine. What exactly does it do with the Camera component? I recall that it’s trivial to change it to use a vcam instead.

But are u sure disabling won’t affect quality?Bcoz as much as i have known it affects quality to some extent
mygiftcardsite.com

I am sure I disabled the camera instead of removing it. In the FirstPersonControler script there is declared CAMERA variable which probably does not work with Cinemachine VC. I tried to add Cinemachine namespace into the script, with intetion to add VC instead of the normal camera, but I was not able to add this namespace to the script. Script did not see this namespace.

I will make an video of the scene in the afternoon.

Normally, you should be able to add the Cinemachine namespace.

Do you have an asmdef in your project? If so, that could be causing the problem. You’ll need to add Ciinemachine to it as a dependency. Or, just delete the asmdef.

After googling asmdef, I think I do not have it in the scene. I made again clean new project and followed your instructions written few posts higher, but the problem is the same. Camera works but it is not possible to look in Y axis. Look around is locked only for X and Z axis. Everything else about the FPS player is normal [controls, sounds, act…].

Send me the new project

Or maybe have a look at this thread: Creating a POV camera

Thank you, I will try to do the changes according your link.
In case you are still interested I am adding here Wetransfer link with the whole project. WeTransfer - Send Large Files & Share Photos Online - Up to 2GB Free

I am switching between two virtual cameras, one is represents the “MENU” cam and second is attached to FPS player. When I hit the ENTER button and Menu camera transition to FPS virtual camera clean master antivirus.