Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
xlar54's avatar
xlar54
Honored Guest
8 years ago

Pool stick - how to attach to both hands?

Im using Touch controllers.  Id like to attach a pool stick to both hands, such that I can move hands around, but the stick will pivot and stay connected to the controllers.  Obviously i can connect it to one hand, but how would I attach to both?

1 Reply

  • xlar54's avatar
    xlar54
    Honored Guest
    disregard.  what i did was place the stick outside of the hands, and attached this script to the stick.  Target is the left hand, and controller is set to right hand in the UI

    using UnityEngine;
    using System.Collections;

    public class StickScript : MonoBehaviour {

        //values that will be set in the Inspector
        public Transform Target;
        public OVRInput.Controller Controller;
    // Update is called once per frame
    void Update () {

            transform.localPosition = OVRInput.GetLocalControllerPosition(Controller);
            transform.LookAt(Target);
        }
    }