PlayMaker Feedback > Action Requests

Cinemachine Get Active Virtual Camera[SOLVED]

<< < (2/2)

Christoph:
That would be if you have different brains in the same scene? How you know though with index is which brain?

And does that mean my action is legit? 😛

djaydino:
Hi.
I never used Cinemachine yet :)

if required you could create an action to compare a 'brain' to get the index.
if you need a certain brain

on your current action you can add the variable and set default to 0
so you can at least set an index :)

Christoph:
Here you go. That should be it then:


--- Code: ---using UnityEngine;
using Cinemachine;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("Cinemachine")]
[Tooltip("Gets the current Virtual Live Camera from the Cinemachine Brain component of your Camera and stores it as a GameObject Variable. Alternatively, you can set the index of the Brain in case you have more than one in your scene.")]

public class GetCinemachineLiveCamera : FsmStateAction
{
[Tooltip("Set the index of the Cinemachine Brain. If your scene only has 1 brain, then the index is 0.")]
public FsmInt brainIndex;

[Tooltip("Set the Game Object variable to store the current Cinemachine Virtual Camera.")]
public FsmGameObject currentVCam;



public override void Reset()
{
brainIndex = 0;
currentVCam = new FsmGameObject { UseVariable = true };
}

public override void OnEnter()
{
//Get the Live vCam
var brain = CinemachineCore.Instance.GetActiveBrain(brainIndex.Value);
currentVCam.Value = brain.ActiveVirtualCamera.VirtualCameraGameObject;

Finish();
}
}
}

--- End code ---

You're missing out by not using Cinemachine djaydino!

djaydino:
Hi.
nah, i'm using a different 3rd party tool for our game.
which fits very well for 2d

Navigation

[0] Message Index

[*] Previous page

Go to full version