I’m trying to have a line show from the hand out as a ray whenever the index trigger is pressed. What I get is if I turn this script off the line shows up just fine. If I turn it on, I can get the debug to show the button was pressed but the line doesn’t show up. I’m at a loss as to why the line renderer is perpetually disabled.
using Oculus.Platform.Models;
using Pixyz.Utils;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Measure : MonoBehaviour
{
//set up rays to represent hand to measurement point and point to point
public LineRenderer lrMeasure2; //Ray from hand to point of measurement
//public LineRenderer Ray; //Line showing point 1 to point 2
//turn line on/off
private bool blLineActive =false;
//get right hand position
public Transform trfmRightHand;
// store input from right hand trigger
private float flHandRight = OVRInput.Get(OVRInput.Axis1D.SecondaryIndexTrigger);
// Start is called before the first frame update
void Start()
{
//Set up line render
Vector3[] v3StartLinePosition = new Vector3[2] { Vector3.zero, Vector3.zero };
lrMeasure2.SetPositions(v3StartLinePosition);
lrMeasure2.enabled = false;
}
// Update is called once per frame
void Update()
{
//string strTemp;
//Run routine if right trigger button is pressed
flHandRight = OVRInput.Get(OVRInput.Axis1D.SecondaryIndexTrigger);
if (flHandRight > 0.9)
{
blLineActive = true;
lrMeasure2.enabled = true;
Debug.Log("Right Trigger Pressed");
RaycastMeasure();
} else
{
lrMeasure2.enabled = false;
blLineActive = false;
}
if (blLineActive)
{
//get point data
RaycastMeasure();
}
}