private void Awake()
        {
            attachJoint = GetComponent <FixedJoint>();
            hasAnimator = animator != null;
            controller  = gameObject.GetComponent <WebXRController>();
#if WEBXR_INPUT_PROFILES
            if (inputProfileObject != null)
            {
                inputProfileLoader = inputProfileObject.GetComponent <InputProfileLoader>();
                if (inputProfileLoader == null)
                {
                    inputProfileLoader = inputProfileObject.AddComponent <InputProfileLoader>();
                }
                var profilesPaths = inputProfileLoader.GetProfilesPaths();
                if (profilesPaths == null || profilesPaths.Count == 0)
                {
                    inputProfileLoader.LoadProfilesList(HandleProfilesList);
                }
                else
                {
                    HandleProfilesList(profilesPaths);
                }
            }
#endif
            SetControllerVisible(false);
            SetHandJointsVisible(false);
        }
 void Awake()
 {
     t           = transform;
     attachJoint = GetComponent <FixedJoint> ();
     anim        = GetComponent <Animator>();
     controller  = GetComponent <WebXRController>();
 }
Ejemplo n.º 3
0
 void Awake()
 {
     attachJoint = GetComponent<FixedJoint>();
     animator = GetComponent<Animator>();
     controller = GetComponent<WebXRController>();
     beam = GetComponent<Beam>();
 }
Ejemplo n.º 4
0
        protected virtual QuickWebXRHandlerController CreateHandlerController(bool isLeft)
        {
            WebXRController[] controllers = GetComponentsInChildren <WebXRController>();
            WebXRController   controller  = null;

            for (int i = 0; i < controllers.Length && !controller; i++)
            {
                WebXRController c = controllers[i];
                if (
                    (isLeft && c.hand == WebXRControllerHand.LEFT) ||
                    (!isLeft && c.hand == WebXRControllerHand.RIGHT)
                    )
                {
                    controller = c;
                }
            }

            if (!controller)
            {
                controller = Instantiate(Resources.Load <WebXRController>("Prefabs/WebXRController" + (isLeft ? "Left" : "Right")));
                controller.transform.parent = transform;
            }

            return(controller.GetOrCreateComponent <QuickWebXRHandlerController>());
        }
Ejemplo n.º 5
0
 public WebXRControllerInfo(BaseControllerBehavior behavior, bool isLeftHand) : base(behavior)
 {
     if (isLeftHand)
     {
         controller = GameObject.Find("handL").GetComponent <WebXRController>();
     }
     else
     {
         controller = GameObject.Find("handR").GetComponent <WebXRController>();
     }
 }
        private void SetUpHands()
        {
            thisHandTransform = transform;

            thisHandAnimator = gameObject.GetComponent <Animator>();

            webXRController = gameObject.GetComponent <WebXRController>();

            //identify the entity type for network calls
            handEntityType = (int)GetComponent <AvatarComponent>().thisEntityType;

            //set old pos for physics calculations
            oldPos = thisHandTransform.position;

            //SetControllerVisible(false);

            //SetHandJointsVisible(false);
        }
Ejemplo n.º 7
0
    void Update()
    {
        WebXRController controller = gameObject.GetComponent <WebXRController>();

        float normalizedTime = controller.GetButton("Trigger") ? 1 : controller.GetAxis("Grip");

        if (controller.GetButtonDown("Trigger") || controller.GetButtonDown("Grip"))
        {
            Pickup();
        }

        if (controller.GetButtonUp("Trigger") || controller.GetButtonUp("Grip"))
        {
            Drop();
        }

        // Use the controller button or axis position to manipulate the playback time for hand model.
        anim.Play("Take", -1, normalizedTime);
    }
Ejemplo n.º 8
0
 protected override void Reset()
 {
     _controller = GetComponent <WebXRController>();
     _role       = _controller.hand == WebXRControllerHand.LEFT ? HumanBodyBones.LeftHand : HumanBodyBones.RightHand;
 }
 void Awake()
 {
     controller     = GetComponent <WebXRController>();
     controllerHand = controller.hand.ToString();
 }
 void Start()
 {
     anim       = gameObject.GetComponent <Animator>();
     controller = gameObject.GetComponent <WebXRController>();
 }
 public void SetWebXRConrtoller(WebXRController controller)
 {
     this.controller = controller;
 }