Hello everybody,
I’m trying to use the impulse system of Cinemachine, I tried everything I could think of and nothing even start to work.
I setup my cameras here :
// Add Cinemachine Brain
var cinemachineBrainObject = new GameObject("CinemachineBrain");
player.cinemachineBrain = cinemachineBrainObject.AddComponent<CinemachineBrain>();
// Ajoutez une caméra virtuelle concrète, pas la classe abstraite
player.cameraObject = new GameObject("CameraObject");
player.camera = player.cameraObject.AddComponent<Camera>();
player.cameraObject.transform.position = new Vector3(0, 5, -25);
player.cameraObject.transform.parent = pawn.pawnObject.transform;
player.cinemachineCamera = player.cameraObject.AddComponent<CinemachineCamera>();
player.cinemachineCamera.Follow = pawn.pawnObject.transform;
player.cinemachineCamera.LookAt = pawn.pawnObject.transform;
player.camera.fieldOfView = 110;
var followComp = player.cameraObject.AddComponent<CinemachineFollow>();
var rotationComp = player.cameraObject.AddComponent<CinemachineRotationComposer>();
var impulseListener = player.cameraObject.AddComponent<CinemachineImpulseListener>();
followComp.FollowOffset = new Vector3(0.0f,0.0f,-15.0f);
impulseListener.Gain = 1.0f;
impulseListener.ApplyAfter = CinemachineCore.Stage.Noise;
//impulseListener.ChannelMask = CinemachineChannelNames.Instance.
var impulseObject = new GameObject("impulseObject");
impulseObject.transform.parent = pawn.pawnObject.transform;
player.impulse = impulseObject.AddComponent<CinemachineImpulseSource>();
player.impulse.ImpulseDefinition = new CinemachineImpulseDefinition
{
ImpulseType = CinemachineImpulseDefinition.ImpulseTypes.Uniform,
ImpulseShape = CinemachineImpulseDefinition.ImpulseShapes.Explosion,
};
And I get those parameters when the game start :
I tried to change everything but I don’t have the beginning of a shake on my camera.
What am I doing wrong ?