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.

30 lines
754 B

  1. namespace VRTK.Examples.Archery
  2. {
  3. using UnityEngine;
  4. public class Follow : MonoBehaviour
  5. {
  6. public bool followPosition;
  7. public bool followRotation;
  8. public Transform target;
  9. private void Update()
  10. {
  11. if (target != null)
  12. {
  13. if (followRotation)
  14. {
  15. transform.rotation = target.rotation;
  16. }
  17. if (followPosition)
  18. {
  19. transform.position = target.position;
  20. }
  21. }
  22. else
  23. {
  24. VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.NOT_DEFINED, "target"));
  25. }
  26. }
  27. }
  28. }