using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using VRTK;

public class AttachDeformingTool : MonoBehaviour {

    private void Start()
    {
        StartCoroutine(AttachToController());
    }

    private IEnumerator AttachToController()
    {
        var followScript = GetComponent<VRTK_TransformFollow>();
        if (followScript != null)
        {
            var leftController = VRTK_DeviceFinder.GetControllerLeftHand(true);
            while (leftController == null)
            {
                leftController = VRTK_DeviceFinder.GetControllerLeftHand(true);
                yield return new WaitForSecondsRealtime(0.2f);
            }
            followScript.gameObjectToFollow = leftController;
        }
    }
}
