Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question How to get impulse position and rotaion value?

Discussion in 'Cinemachine' started by ICICLEboy, Nov 5, 2022.

  1. ICICLEboy

    ICICLEboy

    Joined:
    Aug 7, 2017
    Posts:
    5
    I want to get impulse Signal when use GenerateImpulse is used
    because i want to use canvas shake too
    but i dont know how to use GetImpulseAt()



    using Cinemachine;
    using UnityEngine;

    public class ReciveImpulse : MonoBehaviour
    {
    public Vector3 p = Vector3.one;
    public Quaternion q;

    private void Awake()
    {
    }

    private void Update()
    {
    CinemachineImpulseManager.Instance.GetImpulseAt(this.transform.position, false, 0, out p, out q);
    Debug.Log("shake p : " + p + "shake q : " + q);
    }
    }



    i use this but its not working how to use this?
     
  2. ICICLEboy

    ICICLEboy

    Joined:
    Aug 7, 2017
    Posts:
    5
    sovled it

    just
    CinemachineImpulseManager.Instance.GetImpulseAt(Camera.main.transform.position, false, 1, out p, out q);

    when channal Mask is 0 it cant get Impulse value...

    i set impulsesource impulse channal to everything (also it have 0:default)
     
  3. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,267
    Have a look at CinemachineIndependentImpulseListener. You can use that as-is, or as a basis for your own custom impulse-response script.