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.

23 lines
695 B

  1. namespace VRTK.Examples
  2. {
  3. using UnityEngine;
  4. public class Remote_Beam : MonoBehaviour
  5. {
  6. private Vector2 touchAxis;
  7. private float rotationSpeed = 180f;
  8. private float currentYaw;
  9. private float currentPitch;
  10. public void SetTouchAxis(Vector2 data)
  11. {
  12. touchAxis = data;
  13. }
  14. private void FixedUpdate()
  15. {
  16. currentYaw += touchAxis.y * rotationSpeed * Time.deltaTime;
  17. currentPitch += touchAxis.x * rotationSpeed * Time.deltaTime;
  18. transform.localRotation = Quaternion.AngleAxis(currentPitch, Vector3.up) * Quaternion.AngleAxis(currentYaw, Vector3.left);
  19. }
  20. }
  21. }