Assignment for RMIT Mixed Reality in 2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
634 B

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace EMD.DemoUtility
  5. {
  6. public class SmoothFollowBehaviour : MonoBehaviour
  7. {
  8. [SerializeField]
  9. private Transform m_Target;
  10. [SerializeField]
  11. private float m_SmoothValue = 0.5f;
  12. void LateUpdate()
  13. {
  14. if (m_Target != null)
  15. {
  16. transform.position = Vector3.Lerp(transform.position, m_Target.position, m_SmoothValue);
  17. transform.rotation = Quaternion.Lerp(transform.rotation, m_Target.rotation, m_SmoothValue);
  18. }
  19. }
  20. }
  21. }