SteamVRTrack.cs 898 B

1234567891011121314151617181920212223242526272829
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using Valve.VR;
  6. public class SteamVRTrack : TrackpointMesh
  7. {
  8. public string filePath;
  9. private TrackpointMesh trackpointMesh;
  10. private SteamVR_TrackedObject tracking;
  11. // Start is called before the first frame update
  12. void Start()
  13. {
  14. trackpointMesh = gameObject.AddComponent<TrackpointMesh>();
  15. trackpointMesh.setup(filePath, TrackingSystem.SteamVRTrack);
  16. setupTrackpointTranslationAndRotation();
  17. tracking = gameObject.AddComponent<SteamVR_TrackedObject>();
  18. tracking.index = (SteamVR_TrackedObject.EIndex)1;
  19. }
  20. void setupTrackpointTranslationAndRotation()
  21. {
  22. string metadata = trackpointMesh.getMetaData(TrackingSystem.SteamVRTrack);
  23. trackpointMesh.transform.localPosition = new Vector3(0.0f, 0.0f, 3.0f);
  24. }
  25. }