浏览代码

Updated with several of Tims suggestions

/3.1
David Mohrhardt 5 年前
当前提交
0aeeae03
共有 5 个文件被更改,包括 10 次插入10 次删除
  1. 2
      Assets/Prefabs/AR Fixation Point Visualizer.prefab
  2. 8
      Assets/Scripts/EyePoseVisualizer.cs
  3. 4
      Assets/Scripts/FixationPoint2DVisualizer.cs
  4. 4
      Assets/Scripts/FixationPoint3DVisualizer.cs
  5. 2
      Assets/Scripts/FixationPoint3DVisualizer.cs.meta

2
Assets/Prefabs/AR Fixation Point Visualizer.prefab


m_Script: {fileID: 11500000, guid: 84e9e36f641444746b0c94dcd4bb4518, type: 3}
m_Name:
m_EditorClassIdentifier:
m_FixationPointPrefab: {fileID: 1529176408204727125, guid: 8339cb70cc6014347bd14cfea9e60601,
m_FixationRayPrefab: {fileID: 1529176408204727125, guid: 8339cb70cc6014347bd14cfea9e60601,
type: 3}
--- !u!114 &5426074507876991005
MonoBehaviour:

8
Assets/Scripts/EyePoseVisualizer.cs


void CreateEyeGameObjectsIfNecessary()
{
if (m_Face.leftEyeTransform != null && m_LeftEyeGameObject == null )
if (m_Face.leftEye != null && m_LeftEyeGameObject == null )
m_LeftEyeGameObject = Instantiate(m_EyePrefab, m_Face.leftEyeTransform);
m_LeftEyeGameObject = Instantiate(m_EyePrefab, m_Face.leftEye);
if (m_Face.rightEyeTransform != null && m_RightEyeGameObject == null)
if (m_Face.rightEye != null && m_RightEyeGameObject == null)
m_RightEyeGameObject = Instantiate(m_EyePrefab, m_Face.rightEyeTransform);
m_RightEyeGameObject = Instantiate(m_EyePrefab, m_Face.rightEye);
m_RightEyeGameObject.SetActive(false);
}
}

4
Assets/Scripts/FixationPoint2DVisualizer.cs


void CreateEyeGameObjectsIfNecessary()
{
var canvas = FindObjectOfType<Canvas>();
if (m_Face.fixationPointTransform != null && canvas != null && m_FixationReticleGameObject == null)
if (m_Face.fixationPoint != null && canvas != null && m_FixationReticleGameObject == null)
{
m_FixationReticleGameObject = Instantiate(m_GUIFixationReticlePrefab, canvas.transform);
}

{
var mainCamera = Camera.main;
var fixationInViewSpace = mainCamera.WorldToViewportPoint(m_Face.fixationPointTransform.position);
var fixationInViewSpace = mainCamera.WorldToViewportPoint(m_Face.fixationPoint.position);
// The camera is mirrored so x and y must be changed to match where the fixation point is in relation to the face.
var mirrorFixationInView = new Vector3(1 - fixationInViewSpace.x, 1 - fixationInViewSpace.y, fixationInViewSpace.z);

4
Assets/Scripts/FixationPoint3DVisualizer.cs


void CreateEyeGameObjectsIfNecessary()
{
if (m_FixationRayGameObject == null && m_Face.fixationPointTransform != null)
if (m_FixationRayGameObject == null && m_Face.fixationPoint != null)
{
m_FixationRayGameObject = Instantiate(m_FixationRayPrefab, m_Face.transform);
m_FixationRayGameObject.SetActive(false);

{
if (m_FixationRayGameObject != null)
{
m_FixationRayGameObject.transform.LookAt(m_Face.fixationPointTransform.position);
m_FixationRayGameObject.transform.LookAt(m_Face.fixationPoint.position);
}
}

2
Assets/Scripts/FixationPoint3DVisualizer.cs.meta


externalObjects: {}
serializedVersion: 2
defaultReferences:
- m_FixationPointPrefab: {fileID: 1529176408204727125, guid: 8339cb70cc6014347bd14cfea9e60601,
- m_FixationRayPrefab: {fileID: 1529176408204727125, guid: 8339cb70cc6014347bd14cfea9e60601,
type: 3}
executionOrder: 0
icon: {instanceID: 0}

正在加载...
取消
保存