PlayMaker Feedback > Action Requests
Cinemachine Get Active Virtual Camera[SOLVED]
hoyoyo80:
Hi all,
Ive in dire need to Get Active Virtual Camera, since i have multiple Virtual Camera in my game.
Beside, there a lot of actions that my require acces via PM like transposer offset etc.
Thanks
jeanfabre:
Hi,
Made an update featuring this action "VirtualCameraGetCurrentActive"
it requires the CinemachineBrainProxy component to be in the scene next tot he cinemachine brain to work.
Please update from the Ecosystem. Let me know how it goes.
also, ping me when you don't get any answers to your requests, it's likely that we just did not see it.
Bye,
Jean
hoyoyo80:
Phew...Thanks for the action. Ive use other method to get current active camera but it works. Before this i had lag when switching camera,sudden spike.After change to this action the spike gone 8) Thanks again
Christoph:
Sorry for waking up this old thread. But I wrote this simple action that works perfectly fine for me. I believe the only downside is that it won't work if there's more than one cinemachine brain in the scene. But otherwise probably simpler to implement?
--- Code: ---using UnityEngine;
using Cinemachine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("Cinemachine")]
[Tooltip("Gets the current Live Camera (vCam) from the Cinemachine Brain component on the Main Camera and stores it as a GameObject Variable. Only works if there's a single Cinemachine Brain in the active Scene.")]
public class GetCinemachineLiveCamera : FsmStateAction
{
[Tooltip("The Game Object variable to store the current Cinemachine vCam")]
public FsmGameObject currentVCam;
public override void Reset()
{
currentVCam = new FsmGameObject { UseVariable = true };
}
public override void OnEnter()
{
//Get the Live vCam
var brain = CinemachineCore.Instance.GetActiveBrain(0);
currentVCam.Value = brain.ActiveVirtualCamera.VirtualCameraGameObject;
Finish();
}
}
}
--- End code ---
djaydino:
Hi.
if on
--- Code: ---var brain = CinemachineCore.Instance.GetActiveBrain(0);
--- End code ---
instead of 0 , and a fsmInt index so you can set a index value on the action
on reset you can set : index.Value = 0;
Navigation
[0] Message Index
[#] Next page
Go to full version