Forum Discussion
romain_quessada
5 years agoHonored Guest
[QUEST] Freeze with use of lineRenderers
Hi everyone,
I'm beginner on Unity development and oculus quest development.
I would like to try to display different perimeters. Each perimeter is the same that the outer boundary and i apply it rotations.
So, i reuse an oculus script I have modified. And, to display perirmeter, i reuse lineRenderer.
Problem: with more than one lineRenderer, on the oculus Quest, the application freezes!
Do you know why? Is LineRendrer so resource intensive?
Thanks so much for help
Here the code:
I'm beginner on Unity development and oculus quest development.
I would like to try to display different perimeters. Each perimeter is the same that the outer boundary and i apply it rotations.
So, i reuse an oculus script I have modified. And, to display perirmeter, i reuse lineRenderer.
Problem: with more than one lineRenderer, on the oculus Quest, the application freezes!
Do you know why? Is LineRendrer so resource intensive?
Thanks so much for help
Here the code:
- public class GuardianBoundaryDisplayCustom : MonoBehaviour
- {
- // Depending on the demo manager only for reorient notifications.
- public GuardianBoundaryEnforcer m_enforcer;
- // So that we can easily render the rectangular play area and
- // the more exact outer bounds.
- public OVRBoundary.BoundaryType m_boundaryType;
- // Something to tell the user their guardian bounds aren't configured.
- // This isn't a solution a shipping app would use-- it's just because
- // the demo makes no sense without bounds.
- public GameObject m_errorDisplay;
- void Start()
- {
- m_enforcer.TrackingChanged += RefreshDisplay;
- RefreshDisplay();
- }
- void RefreshDisplay()
- {
- bool configured = OVRManager.boundary.GetConfigured();
- if (configured)
- {
- LineRenderer lr = GetComponent<LineRenderer>();
- lr.positionCount = 0;
- // Note that these points are returned in (the newly reoriented) tracking space.
- // So rendering them correctly aligned with your guardian bounds in VR is
- // straightforward, and does not require additional transformations as long
- // as this is parented to the TrackingSpace node.
- Vector3[] boundaryPoints = OVRManager.boundary.GetGeometry(m_boundaryType);
- lr.positionCount = boundaryPoints.Length + 1;
- Vector3 v;
- for (int i = 0; i < boundaryPoints.Length; ++i)
- {
- v = boundaryPoints;
- v.y = 0.0f;
- lr.SetPosition(i, v);
- }
- v = boundaryPoints[0];
- v.y = 0.0f;
- lr.SetPosition(boundaryPoints.Length, v);
- lr.startColor = Color.blue;
- lr.endColor = Color.blue;
- LineRenderer lr2 = Instantiate(lr);
- lr2.startColor = Color.red;
- lr2.endColor = Color.red;
- lr2.transform.Rotate(0.0f,180.0f,0.0f, Space.Self);
- LineRenderer lr3 = Instantiate(lr);
- lr3.startColor = Color.yellow;
- lr3.endColor = Color.yellow;
- lr3.transform.Rotate(0.0f, 180.0f, 0.0f, Space.Self);
- //TODO utiliser lr3.bounds.center pour décaler le périmètre
- }
- if (m_errorDisplay)
- {
- m_errorDisplay.SetActive(!configured);
- }
- }
- // Update is called once per frame
- void Update()
- {
- }
- }
Replies have been turned off for this discussion
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 9 months ago