|
@@ -17,7 +17,7 @@ public class SteamVRTrack : MonoBehaviour
|
|
private List<ActionPoint> actionPoints = new List<ActionPoint>();
|
|
private List<ActionPoint> actionPoints = new List<ActionPoint>();
|
|
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()
|
|
{
|
|
{
|
|
@@ -48,7 +48,7 @@ public class SteamVRTrack : MonoBehaviour
|
|
float[] normal = metaObject[0].normal;
|
|
float[] normal = metaObject[0].normal;
|
|
trackpointMesh.transform.localPosition = new Vector3(-(point[0] / divisor), -(point[1] / divisor), -(point[2] / divisor));
|
|
trackpointMesh.transform.localPosition = new Vector3(-(point[0] / divisor), -(point[1] / divisor), -(point[2] / divisor));
|
|
Vector3 unityNormal = new Vector3(normal[0], normal[2], normal[1]);
|
|
Vector3 unityNormal = new Vector3(normal[0], normal[2], normal[1]);
|
|
- Quaternion rotateObjectToTrackpoint = Quaternion.FromToRotation(Vector3.up, unityNormal);
|
|
|
|
|
|
+ Quaternion rotateObjectToTrackpoint = Quaternion.FromToRotation(Vector3.up, unityNormal);
|
|
Quaternion correction = Quaternion.AngleAxis(rotationCorrection, Vector3.back);
|
|
Quaternion correction = Quaternion.AngleAxis(rotationCorrection, Vector3.back);
|
|
Quaternion result = correction * rotateObjectToTrackpoint;
|
|
Quaternion result = correction * rotateObjectToTrackpoint;
|
|
rotationObject.transform.rotation = result;
|
|
rotationObject.transform.rotation = result;
|
|
@@ -66,8 +66,8 @@ public class SteamVRTrack : MonoBehaviour
|
|
float[] point = actionPoint.Value.point;
|
|
float[] point = actionPoint.Value.point;
|
|
float[] normal = actionPoint.Value.normal;
|
|
float[] normal = actionPoint.Value.normal;
|
|
anchor.transform.localPosition = new Vector3(point[0] / divisor, point[1] / divisor, point[2] / divisor);
|
|
anchor.transform.localPosition = new Vector3(point[0] / divisor, point[1] / divisor, point[2] / divisor);
|
|
- Vector3 unityNormal = new Vector3(normal[0], normal[2], normal[1]);
|
|
|
|
- anchor.transform.rotation = Quaternion.FromToRotation(Vector3.up, unityNormal);
|
|
|
|
|
|
+ Vector3 unityNormal = new Vector3(normal[0], normal[1], normal[2]);
|
|
|
|
+ anchor.transform.localRotation = Quaternion.FromToRotation(Vector3.up, unityNormal);
|
|
ActionPoint actionPointObject = anchor.AddComponent<ActionPoint>();
|
|
ActionPoint actionPointObject = anchor.AddComponent<ActionPoint>();
|
|
actionPointObject.setup();
|
|
actionPointObject.setup();
|
|
actionPoints.Add(actionPointObject);
|
|
actionPoints.Add(actionPointObject);
|
|
@@ -88,4 +88,4 @@ public class trackpoints
|
|
get;
|
|
get;
|
|
set;
|
|
set;
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
+}
|