소스 검색

Fix hierarchy to make translation and rotation of mesh working

Johannes Kreutz 2 년 전
부모
커밋
c3e0ed04f7
1개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  1. 5 1
      track-client/TrackClient/Assets/TrackpointApp/SteamVRTrack.cs

+ 5 - 1
track-client/TrackClient/Assets/TrackpointApp/SteamVRTrack.cs

@@ -1,6 +1,7 @@
 using System;
 using System;
 using System.Collections;
 using System.Collections;
 using System.Collections.Generic;
 using System.Collections.Generic;
+using Newtonsoft.Json;
 using UnityEngine;
 using UnityEngine;
 using Valve.VR;
 using Valve.VR;
 
 
@@ -8,13 +9,16 @@ public class SteamVRTrack : TrackpointMesh
 {
 {
     public string filePath;
     public string filePath;
 
 
+    private GameObject meshObject;
     private TrackpointMesh trackpointMesh;
     private TrackpointMesh trackpointMesh;
     private SteamVR_TrackedObject tracking;
     private SteamVR_TrackedObject tracking;
     
     
     // Start is called before the first frame update
     // Start is called before the first frame update
     void Start()
     void Start()
     {
     {
-        trackpointMesh = gameObject.AddComponent<TrackpointMesh>();
+        meshObject = new GameObject();
+        trackpointMesh = meshObject.AddComponent<TrackpointMesh>();
+        trackpointMesh.transform.parent = this.transform;
         trackpointMesh.setup(filePath, TrackingSystem.SteamVRTrack);
         trackpointMesh.setup(filePath, TrackingSystem.SteamVRTrack);
         setupTrackpointTranslationAndRotation();
         setupTrackpointTranslationAndRotation();
         tracking = gameObject.AddComponent<SteamVR_TrackedObject>();
         tracking = gameObject.AddComponent<SteamVR_TrackedObject>();