Forum rules - please read before posting.

Switching Cine Machine virtual cameras

I have a Cine Machine Brain attached to my Default Camera and have created two separate Cine Machine Virtual Cameras in the same scene. I'd like to switch between them based on hotspot clicking.

Can I do this through Action Lists?
Am I right in thinking it's the "priority" number in the Virtual Cameras Inspector window which determines which is being viewed through?

Thank you.

Comments

  • Cinemachine cameras can be controlled either by priority numbers, or by disabling/enabling the GameObjects they're attached to.

    Cinemachine is a separate asset to AC, so you'd have to either rely on animation or a custom Action to control it if you wish to control it via an AC ActionList.

    Such a custom Action (though unofficial) can be found in the AC wiki here: https://adventure-creator.fandom.com/wiki/Changing_Cinemachine_camera_priority

  • Thank you as always Chris. I'll get started on implementing this.

  • edited February 2019

    That all works, however I've found that your 2d Paralax component does not work with CM virtual cameras, only working with "real" cameras. This is a shame as there are functions of the CMs which I really want for my game.

    Is there a way to get your 2d Paralax component to look to Virtual Cameras instead of real cameras?

  • If you don't assign an AC GameCamera2D your the AC MainCamera, the Parallax2D effect should apply to whatever your MainCamera is. Is the AC MainCamera following the CinemachineBrain?

    Alternatively, since the Parallax2D script is isolated from the rest of AC, you can duplicate it and modify your copy to have it react to Cinemachine. The only references it makes to any cameras are on lines 99, 101, and 105.

  • Ah ok thanks for that. The AC maincamera has the CinemachineBrain. What happens is that the parallax uses the main camera as the anchor point, so the object in my room no.2 doesn't even appear on screen when showing that room through one of my CM virtual cameras.

    Editing the script seems like the easiest option, so I'll have a crack at that.

  • Well the scripting is beyond me at the moment.

    For the record, I've gone with a more rough and ready approach, using the offset slider in the 2dParallax component, with greater effect the further from the main camera each room is. It's not ideal, but it works in game. Hopefully it wont get too messy as I make more rooms. Maybe I'll have to have more real cameras with CM brains with virtual CM cameras attached for different collections of rooms in the game, to keep this under control.

    Thanks for your help, advice and patience.

  • I've taken your advice and dived into animating objects and its very useful.

    I am now using one camera which transitions to different animation states (camera positions) depending on which room the player is in. This is much cleaner :)

    I have tested the camera transition condition being changed directly in a Hotspot Action List and this works.

    I am trying now to get this transition to happen only when a pop up switch is flipped. So in the action list of the hotspot I have a Variable - Set node to flip the switch. This works fine.

    I am then using a Variable Pop Up Switch in another Action List to Change the camera transition condition if the switch is flipped. No change happens here. Its like the Variable Popup Switch node is not being engaged with.

    Do I need to be setting this to always be checking somehow?

  • I think I got this, with an ActionList Run Node on the hotspot.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.