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.

27 lines
617 B

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class RotationController : MonoBehaviour
  5. {
  6. #region Read-Only Fields
  7. public float RotationPeriod => m_RotationPeriod;
  8. public Vector3 Position => transform.position;
  9. #endregion Read-Only Fields
  10. [SerializeField]
  11. private float m_RotationPeriod;
  12. [SerializeField]
  13. private Vector3 m_RotationAxis = Vector3.forward;
  14. public Vector3 getDownDirection(Vector3 objectPosition)
  15. {
  16. return Vector3.ProjectOnPlane((objectPosition - transform.position).normalized, m_RotationAxis);
  17. }
  18. }