Alexandra Serralta
5 年前
当前提交
2dda4dcd
共有 54 个文件被更改,包括 4356 次插入 和 4198 次删除
-
139Assets/Scenes/ARCollaborationData/AnchorInfoManager.cs
-
95Assets/Scenes/ARCollaborationData/CollaborationNetworkingIndicator.cs
-
199Assets/Scenes/ARCollaborationData/CollaborativeSession.cs
-
57Assets/Scenes/ARCollaborationData/DisplayTrackingState.cs
-
243Assets/Scenes/ARKitCoachingOverlay/ARKitCoachingOverlay.cs
-
53Assets/Scenes/CameraGrain/CameraGrain.cs
-
235Assets/Scenes/FaceTracking/DisplayFaceInfo.cs
-
2Assets/Scenes/FaceTracking/EyeLasers.unity
-
57Assets/Scenes/FaceTracking/ToggleCameraFacingDirection.cs
-
301Assets/Scenes/ImageTracking/DynamicLibrary.cs
-
167Assets/Scenes/ImageTracking/TrackedImageInfoManager.cs
-
75Assets/Scenes/LightEstimation/PlatformSelector.cs
-
17Assets/Scenes/LightEstimation/Rotator.cs
-
487Assets/Scenes/Meshing/Scripts/MeshClassificationFracking.cs
-
69Assets/Scenes/Meshing/Scripts/ProjectileLauncher.cs
-
89Assets/Scenes/Meshing/Scripts/ToggleMeshClassification.cs
-
147Assets/Scenes/Plane Detection/PlaneClassificationLabeler.cs
-
59Assets/Scenes/SimpleAR/SessionReloader.cs
-
137Assets/Scripts/ARCoreFaceRegionManager.cs
-
167Assets/Scripts/ARFeatheredPlaneMeshVisualizer.cs
-
309Assets/Scripts/ARKitBlendShapeVisualizer.cs
-
497Assets/Scripts/ARWorldMapController.cs
-
80Assets/Scripts/AnchorCreator.cs
-
319Assets/Scripts/BoneController.cs
-
167Assets/Scripts/CameraConfigController.cs
-
395Assets/Scripts/CpuImageSample.cs
-
79Assets/Scripts/DisableVerticalPlanes.cs
-
45Assets/Scripts/EnvironmentProbeVisualizer.cs
-
122Assets/Scripts/EyePoseVisualizer.cs
-
41Assets/Scripts/EyeTrackingUI.cs
-
57Assets/Scripts/FaceMaterialSwitcher.cs
-
136Assets/Scripts/FixationPoint2DVisualizer.cs
-
120Assets/Scripts/FixationPoint3DVisualizer.cs
-
121Assets/Scripts/HumanBodyTracker.cs
-
265Assets/Scripts/LightEstimation.cs
-
227Assets/Scripts/LightEstimationUI.cs
-
99Assets/Scripts/Logger.cs
-
109Assets/Scripts/MakeAppearOnPlane.cs
-
81Assets/Scripts/PlaceMultipleObjectsOnPlane.cs
-
125Assets/Scripts/PlaceOnPlane.cs
-
99Assets/Scripts/PlaneDetectionController.cs
-
165Assets/Scripts/RotationController.cs
-
163Assets/Scripts/ScaleController.cs
-
241Assets/Scripts/ScreenSpaceJointVisualizer.cs
-
197Assets/Scripts/SupportChecker.cs
-
93Assets/Scripts/TestBodyAnchorScale.cs
-
189Assets/Scripts/TestDepthImage.cs
-
371Assets/Scripts/UX/ARSceneSelectUI.cs
-
24Assets/Scripts/UX/ActiveMenu.cs
-
41Assets/Scripts/UX/BackButton.cs
-
481Assets/Scripts/UX/CheckAvailableFeatures.cs
-
77Assets/Scripts/UX/FadePlaneOnBoundaryChange.cs
-
61Assets/Scripts/UX/Tooltip.cs
-
163Assets/Scripts/UX/UIManager.cs
|
|||
using UnityEngine; |
|||
using UnityEngine.XR.ARFoundation; |
|||
|
|||
public class ToggleCameraFacingDirection : MonoBehaviour |
|||
namespace UnityEngine.XR.ARFoundation.Samples |
|||
[SerializeField] |
|||
ARCameraManager m_CameraManager; |
|||
|
|||
public ARCameraManager cameraManager |
|||
public class ToggleCameraFacingDirection : MonoBehaviour |
|||
get => m_CameraManager; |
|||
set => m_CameraManager = value; |
|||
} |
|||
[SerializeField] |
|||
ARCameraManager m_CameraManager; |
|||
[SerializeField] |
|||
ARSession m_Session; |
|||
public ARCameraManager cameraManager |
|||
{ |
|||
get => m_CameraManager; |
|||
set => m_CameraManager = value; |
|||
} |
|||
public ARSession session |
|||
{ |
|||
get => m_Session; |
|||
set => m_Session = value; |
|||
} |
|||
[SerializeField] |
|||
ARSession m_Session; |
|||
void Update() |
|||
{ |
|||
if (m_CameraManager == null || m_Session == null) |
|||
return; |
|||
public ARSession session |
|||
{ |
|||
get => m_Session; |
|||
set => m_Session = value; |
|||
} |
|||
if (Input.touchCount > 0 && Input.touches[0].phase == TouchPhase.Began) |
|||
void Update() |
|||
if (m_CameraManager.requestedFacingDirection == CameraFacingDirection.User) |
|||
{ |
|||
m_CameraManager.requestedFacingDirection = CameraFacingDirection.World; |
|||
} |
|||
else |
|||
if (m_CameraManager == null || m_Session == null) |
|||
return; |
|||
|
|||
if (Input.touchCount > 0 && Input.touches[0].phase == TouchPhase.Began) |
|||
m_CameraManager.requestedFacingDirection = CameraFacingDirection.User; |
|||
if (m_CameraManager.requestedFacingDirection == CameraFacingDirection.User) |
|||
{ |
|||
m_CameraManager.requestedFacingDirection = CameraFacingDirection.World; |
|||
} |
|||
else |
|||
{ |
|||
m_CameraManager.requestedFacingDirection = CameraFacingDirection.User; |
|||
} |
|||
} |
|||
} |
|
|||
using UnityEngine; |
|||
|
|||
/// <summary>
|
|||
/// Launches projectiles from a touch point with the specified <see cref="initialSpeed"/>.
|
|||
/// </summary>
|
|||
[RequireComponent(typeof(Camera))] |
|||
public class ProjectileLauncher : MonoBehaviour |
|||
namespace UnityEngine.XR.ARFoundation.Samples |
|||
[SerializeField] |
|||
Rigidbody m_ProjectilePrefab; |
|||
/// <summary>
|
|||
/// Launches projectiles from a touch point with the specified <see cref="initialSpeed"/>.
|
|||
/// </summary>
|
|||
[RequireComponent(typeof(Camera))] |
|||
public class ProjectileLauncher : MonoBehaviour |
|||
{ |
|||
[SerializeField] |
|||
Rigidbody m_ProjectilePrefab; |
|||
public Rigidbody projectilePrefab |
|||
{ |
|||
get => m_ProjectilePrefab; |
|||
set => m_ProjectilePrefab = value; |
|||
} |
|||
public Rigidbody projectilePrefab |
|||
{ |
|||
get => m_ProjectilePrefab; |
|||
set => m_ProjectilePrefab = value; |
|||
} |
|||
[SerializeField] |
|||
float m_InitialSpeed = 25; |
|||
[SerializeField] |
|||
float m_InitialSpeed = 25; |
|||
public float initialSpeed |
|||
{ |
|||
get => m_InitialSpeed; |
|||
set => m_InitialSpeed = value; |
|||
} |
|||
public float initialSpeed |
|||
{ |
|||
get => m_InitialSpeed; |
|||
set => m_InitialSpeed = value; |
|||
} |
|||
void Update() |
|||
{ |
|||
if (m_ProjectilePrefab == null) |
|||
return; |
|||
void Update() |
|||
{ |
|||
if (m_ProjectilePrefab == null) |
|||
return; |
|||
if (Input.touchCount == 0) |
|||
return; |
|||
if (Input.touchCount == 0) |
|||
return; |
|||
var touch = Input.touches[0]; |
|||
if (touch.phase == TouchPhase.Began) |
|||
{ |
|||
var ray = GetComponent<Camera>().ScreenPointToRay(touch.position); |
|||
var projectile = Instantiate(m_ProjectilePrefab, ray.origin, Quaternion.identity); |
|||
var rigidbody = projectile.GetComponent<Rigidbody>(); |
|||
rigidbody.velocity = ray.direction * m_InitialSpeed; |
|||
var touch = Input.touches[0]; |
|||
if (touch.phase == TouchPhase.Began) |
|||
{ |
|||
var ray = GetComponent<Camera>().ScreenPointToRay(touch.position); |
|||
var projectile = Instantiate(m_ProjectilePrefab, ray.origin, Quaternion.identity); |
|||
var rigidbody = projectile.GetComponent<Rigidbody>(); |
|||
rigidbody.velocity = ray.direction * m_InitialSpeed; |
|||
} |
|||
} |
|||
} |
|
|||
using UnityEngine; |
|||
|
|||
[RequireComponent(typeof(MeshRenderer))] |
|||
public class EnvironmentProbeVisualizer : MonoBehaviour |
|||
namespace UnityEngine.XR.ARFoundation.Samples |
|||
[SerializeField] |
|||
ReflectionProbe m_ReflectionProbe; |
|||
|
|||
public ReflectionProbe reflectionProbe |
|||
[RequireComponent(typeof(MeshRenderer))] |
|||
public class EnvironmentProbeVisualizer : MonoBehaviour |
|||
get { return m_ReflectionProbe; } |
|||
set { m_ReflectionProbe = value; } |
|||
} |
|||
[SerializeField] |
|||
ReflectionProbe m_ReflectionProbe; |
|||
void Update() |
|||
{ |
|||
if (m_ReflectionProbe == null) |
|||
public ReflectionProbe reflectionProbe |
|||
GetComponent<MeshRenderer>().enabled = false; |
|||
get { return m_ReflectionProbe; } |
|||
set { m_ReflectionProbe = value; } |
|||
else |
|||
|
|||
void Update() |
|||
GetComponent<MeshRenderer>().enabled = true; |
|||
if (m_ReflectionProbe == null) |
|||
{ |
|||
GetComponent<MeshRenderer>().enabled = false; |
|||
} |
|||
else |
|||
{ |
|||
GetComponent<MeshRenderer>().enabled = true; |
|||
transform.localPosition = m_ReflectionProbe.center; |
|||
transform.localScale = m_ReflectionProbe.size; |
|||
transform.localPosition = m_ReflectionProbe.center; |
|||
transform.localScale = m_ReflectionProbe.size; |
|||
// Unity doesn't yet support rotated reflection probes, so the visualizer
|
|||
// needs to unrotate in order to display the box that will actually be used.
|
|||
transform.localRotation = Quaternion.Inverse(m_ReflectionProbe.transform.rotation); |
|||
// Unity doesn't yet support rotated reflection probes, so the visualizer
|
|||
// needs to unrotate in order to display the box that will actually be used.
|
|||
transform.localRotation = Quaternion.Inverse(m_ReflectionProbe.transform.rotation); |
|||
} |
|||
} |
|||
} |
|
|||
using UnityEngine; |
|||
using UnityEngine.UI; |
|||
|
|||
/// <summary>
|
|||
/// Controls the orientation of content place by the <see cref="MakeAppearOnPlane"/>
|
|||
/// component using a UI.Slider to affect the rotation about the Y axis.
|
|||
/// </summary>
|
|||
[RequireComponent(typeof(MakeAppearOnPlane))] |
|||
public class RotationController : MonoBehaviour |
|||
namespace UnityEngine.XR.ARFoundation.Samples |
|||
MakeAppearOnPlane m_MakeAppearOnPlane; |
|||
|
|||
[SerializeField] |
|||
[Tooltip("The slider used to control rotation.")] |
|||
Slider m_Slider; |
|||
|
|||
/// The slider used to control scale.
|
|||
/// Controls the orientation of content place by the <see cref="MakeAppearOnPlane"/>
|
|||
/// component using a UI.Slider to affect the rotation about the Y axis.
|
|||
public Slider slider |
|||
[RequireComponent(typeof(MakeAppearOnPlane))] |
|||
public class RotationController : MonoBehaviour |
|||
get { return m_Slider; } |
|||
set { m_Slider = value; } |
|||
} |
|||
MakeAppearOnPlane m_MakeAppearOnPlane; |
|||
|
|||
[SerializeField] |
|||
[Tooltip("The slider used to control rotation.")] |
|||
Slider m_Slider; |
|||
[SerializeField] |
|||
[Tooltip("The text used to display the current rotation on the screen.")] |
|||
Text m_Text; |
|||
/// <summary>
|
|||
/// The slider used to control scale.
|
|||
/// </summary>
|
|||
public Slider slider |
|||
{ |
|||
get { return m_Slider; } |
|||
set { m_Slider = value; } |
|||
} |
|||
/// <summary>
|
|||
/// The text used to display the current rotation on the screen.
|
|||
/// </summary>
|
|||
public Text text |
|||
{ |
|||
get { return m_Text; } |
|||
set { m_Text = value; } |
|||
} |
|||
[SerializeField] |
|||
[Tooltip("The text used to display the current rotation on the screen.")] |
|||
Text m_Text; |
|||
[SerializeField] |
|||
[Tooltip("Minimum rotation angle in degrees.")] |
|||
public float m_Min = 0f; |
|||
/// <summary>
|
|||
/// The text used to display the current rotation on the screen.
|
|||
/// </summary>
|
|||
public Text text |
|||
{ |
|||
get { return m_Text; } |
|||
set { m_Text = value; } |
|||
} |
|||
/// <summary>
|
|||
/// Minimum angle in degrees.
|
|||
/// </summary>
|
|||
public float min |
|||
{ |
|||
get { return m_Min; } |
|||
set { m_Min = value; } |
|||
} |
|||
[SerializeField] |
|||
[Tooltip("Minimum rotation angle in degrees.")] |
|||
public float m_Min = 0f; |
|||
[SerializeField] |
|||
[Tooltip("Maximum angle in degrees.")] |
|||
public float m_Max = 360f; |
|||
/// <summary>
|
|||
/// Minimum angle in degrees.
|
|||
/// </summary>
|
|||
public float min |
|||
{ |
|||
get { return m_Min; } |
|||
set { m_Min = value; } |
|||
} |
|||
/// <summary>
|
|||
/// Maximum angle in degrees.
|
|||
/// </summary>
|
|||
public float max |
|||
{ |
|||
get { return m_Max; } |
|||
set { m_Max = value; } |
|||
} |
|||
[SerializeField] |
|||
[Tooltip("Maximum angle in degrees.")] |
|||
public float m_Max = 360f; |
|||
/// <summary>
|
|||
/// Invoked when the slider's value changes
|
|||
/// </summary>
|
|||
public void OnSliderValueChanged() |
|||
{ |
|||
if (slider != null) |
|||
angle = slider.value * (max - min) + min; |
|||
} |
|||
/// <summary>
|
|||
/// Maximum angle in degrees.
|
|||
/// </summary>
|
|||
public float max |
|||
{ |
|||
get { return m_Max; } |
|||
set { m_Max = value; } |
|||
} |
|||
float angle |
|||
{ |
|||
get |
|||
/// <summary>
|
|||
/// Invoked when the slider's value changes
|
|||
/// </summary>
|
|||
public void OnSliderValueChanged() |
|||
return m_MakeAppearOnPlane.rotation.eulerAngles.y; |
|||
if (slider != null) |
|||
angle = slider.value * (max - min) + min; |
|||
set |
|||
|
|||
float angle |
|||
m_MakeAppearOnPlane.rotation = Quaternion.AngleAxis(value, Vector3.up); |
|||
UpdateText(); |
|||
get |
|||
{ |
|||
return m_MakeAppearOnPlane.rotation.eulerAngles.y; |
|||
} |
|||
set |
|||
{ |
|||
m_MakeAppearOnPlane.rotation = Quaternion.AngleAxis(value, Vector3.up); |
|||
UpdateText(); |
|||
} |
|||
} |
|||
void Awake() |
|||
{ |
|||
m_MakeAppearOnPlane = GetComponent<MakeAppearOnPlane>(); |
|||
} |
|||
void Awake() |
|||
{ |
|||
m_MakeAppearOnPlane = GetComponent<MakeAppearOnPlane>(); |
|||
} |
|||
void OnEnable() |
|||
{ |
|||
if (slider != null) |
|||
slider.value = (angle - min) / (max - min); |
|||
UpdateText(); |
|||
} |
|||
void OnEnable() |
|||
{ |
|||
if (slider != null) |
|||
slider.value = (angle - min) / (max - min); |
|||
UpdateText(); |
|||
} |
|||
void UpdateText() |
|||
{ |
|||
if (m_Text != null) |
|||
m_Text.text = "Rotation: " + angle + " degrees"; |
|||
void UpdateText() |
|||
{ |
|||
if (m_Text != null) |
|||
m_Text.text = "Rotation: " + angle + " degrees"; |
|||
} |
|||
} |
|||
} |
|
|||
using UnityEngine; |
|||
using UnityEngine.XR.ARFoundation; |
|||
|
|||
[RequireComponent(typeof(ARPlane))] |
|||
[RequireComponent(typeof(Animator))] |
|||
public class FadePlaneOnBoundaryChange : MonoBehaviour |
|||
namespace UnityEngine.XR.ARFoundation.Samples |
|||
const string k_FadeOffAnim = "FadeOff"; |
|||
const string k_FadeOnAnim = "FadeOn"; |
|||
const float k_TimeOut = 2.0f; |
|||
|
|||
Animator m_Animator; |
|||
ARPlane m_Plane; |
|||
[RequireComponent(typeof(ARPlane))] |
|||
[RequireComponent(typeof(Animator))] |
|||
public class FadePlaneOnBoundaryChange : MonoBehaviour |
|||
{ |
|||
const string k_FadeOffAnim = "FadeOff"; |
|||
const string k_FadeOnAnim = "FadeOn"; |
|||
const float k_TimeOut = 2.0f; |
|||
|
|||
Animator m_Animator; |
|||
ARPlane m_Plane; |
|||
float m_ShowTime = 0; |
|||
bool m_UpdatingPlane = false; |
|||
float m_ShowTime = 0; |
|||
bool m_UpdatingPlane = false; |
|||
void OnEnable() |
|||
{ |
|||
m_Plane = GetComponent<ARPlane>(); |
|||
m_Animator = GetComponent<Animator>(); |
|||
|
|||
m_Plane.boundaryChanged += PlaneOnBoundaryChanged; |
|||
} |
|||
void OnEnable() |
|||
{ |
|||
m_Plane = GetComponent<ARPlane>(); |
|||
m_Animator = GetComponent<Animator>(); |
|||
void OnDisable() |
|||
{ |
|||
m_Plane.boundaryChanged -= PlaneOnBoundaryChanged; |
|||
} |
|||
m_Plane.boundaryChanged += PlaneOnBoundaryChanged; |
|||
} |
|||
void Update() |
|||
{ |
|||
if (m_UpdatingPlane) |
|||
void OnDisable() |
|||
m_ShowTime -= Time.deltaTime; |
|||
m_Plane.boundaryChanged -= PlaneOnBoundaryChanged; |
|||
} |
|||
if (m_ShowTime <= 0) |
|||
void Update() |
|||
{ |
|||
if (m_UpdatingPlane) |
|||
m_UpdatingPlane = false; |
|||
m_Animator.SetBool(k_FadeOffAnim, true); |
|||
m_Animator.SetBool(k_FadeOnAnim, false); |
|||
m_ShowTime -= Time.deltaTime; |
|||
|
|||
if (m_ShowTime <= 0) |
|||
{ |
|||
m_UpdatingPlane = false; |
|||
m_Animator.SetBool(k_FadeOffAnim, true); |
|||
m_Animator.SetBool(k_FadeOnAnim, false); |
|||
} |
|||
} |
|||
void PlaneOnBoundaryChanged(ARPlaneBoundaryChangedEventArgs obj) |
|||
{ |
|||
m_Animator.SetBool(k_FadeOffAnim, false); |
|||
m_Animator.SetBool(k_FadeOnAnim, true); |
|||
m_UpdatingPlane = true; |
|||
m_ShowTime = k_TimeOut; |
|||
void PlaneOnBoundaryChanged(ARPlaneBoundaryChangedEventArgs obj) |
|||
{ |
|||
m_Animator.SetBool(k_FadeOffAnim, false); |
|||
m_Animator.SetBool(k_FadeOnAnim, true); |
|||
m_UpdatingPlane = true; |
|||
m_ShowTime = k_TimeOut; |
|||
} |
|||
} |
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue