I have an impulse listener extension on the Cine Machine Camera. I then have a impulse source on my player in which I trigger a 6D shake from a script. However the shake gets increasingly more intense the more I travel on the X Axis and I cant for the life of me get it to be consistent.
So, I have the 6d shake triggered when my player lands his jump (triggered by an animation event). To trigger it, i have my own script that calls the API ‘generateimpulse’ method which is of course part of the cinemachine impulse source script attached to the player.
If i jump at 0 on the X-axis, its normal. If i jump at 20, its crazy. Then at 60 on the X-axis its insanely shakey. if i then move the player back to 0, the shake goes back to normal. so its something to do with positioning.
I have tried altering all inspector settings for the impulse source to no avail.
Hey, Sure! Sorry, Im not completely familiar with the formatting on the forum but below is the trigger code and the photo of the impulse source inspector. Just to reiterate that method is triggered by an animation event and the code is attached to the player as well as the impulse source.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Cinemachine;
public class CineMCreateImpule : MonoBehaviour
{
[SerializeField]
CinemachineImpulseSource cSource;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
The problem is here. Instead of the position, you should instead add a vector representing a direction. For example, (player.position - transform.position).normalized * impulseSpeed.
This is the function signature for reference:
/// <summary>Broadcast the Impulse Signal onto the appropriate channels, using
/// a custom impact velocity, and this transfom's position.</summary>
/// <param name="velocity">The impact magnitude and direction</param>
public void GenerateImpulse(Vector3 velocity)
{
GenerateImpulseAt(transform.position, velocity);
}
Check out our example scenes, they show how to use impulses with collisions and how impulses are propagated. The examples are called ‘Impulse’ and ‘ImpulseWave’. You can import our examples from the package manager.
Ahh, ok. Great! Thank you very much for your help. I am away from my PC until tomorrow evening so I will try it then and reply further if I have issues. Hopefully, I should be ok because I understand what you mean.