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
931 B

  1. namespace VRTK.Examples
  2. {
  3. using UnityEngine;
  4. public class Remote_Beam_Controller : MonoBehaviour
  5. {
  6. public GameObject remoteBeam;
  7. private Remote_Beam remoteBeamScript;
  8. private void Start()
  9. {
  10. remoteBeamScript = remoteBeam.GetComponent<Remote_Beam>();
  11. GetComponent<VRTK_ControllerEvents>().TouchpadAxisChanged += new ControllerInteractionEventHandler(DoTouchpadAxisChanged);
  12. GetComponent<VRTK_ControllerEvents>().TouchpadTouchEnd += new ControllerInteractionEventHandler(DoTouchpadTouchEnd);
  13. }
  14. private void DoTouchpadAxisChanged(object sender, ControllerInteractionEventArgs e)
  15. {
  16. remoteBeamScript.SetTouchAxis(e.touchpadAxis);
  17. }
  18. private void DoTouchpadTouchEnd(object sender, ControllerInteractionEventArgs e)
  19. {
  20. remoteBeamScript.SetTouchAxis(Vector2.zero);
  21. }
  22. }
  23. }