David Mohrhardt
5 年前
当前提交
101a5d1a
共有 19 个文件被更改,包括 631 次插入 和 234 次删除
-
15Assets/Prefabs/AR Fixation Point Visualizer.prefab
-
4Assets/Prefabs/FixationReticle.prefab
-
166Assets/Scenes/FaceTracking/FixationPoint.unity
-
126Assets/Prefabs/FixationRayPrefab.prefab
-
7Assets/Prefabs/FixationRayPrefab.prefab.meta
-
93Assets/Scripts/FixationPoint2DVisualizer.cs
-
13Assets/Scripts/FixationPoint2DVisualizer.cs.meta
-
87Assets/Scripts/FixationPoint3DVisualizer.cs
-
13Assets/Scripts/FixationPoint3DVisualizer.cs.meta
-
20Assets/Textures/Reticle.png
-
91Assets/Textures/Reticle.png.meta
-
11Assets/Scripts/FixationPointVisualizer.cs.meta
-
123Assets/Scripts/FixationPointVisualizer.cs
-
53Assets/Shaders/DoubleSidedSurfaceShader.shader
-
9Assets/Shaders/DoubleSidedSurfaceShader.shader.meta
-
23Assets/MoveReticle.cs
-
11Assets/MoveReticle.cs.meta
-
0/Assets/Prefabs/FixationReticle.prefab.meta
-
0/Assets/Prefabs/FixationReticle.prefab
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!1 &795713508893815543 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 4175560679010963632} |
|||
- component: {fileID: 6833705460578319375} |
|||
- component: {fileID: 4622826133050988356} |
|||
- component: {fileID: 7010878674475661216} |
|||
m_Layer: 0 |
|||
m_Name: LookAtRay |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!4 &4175560679010963632 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 795713508893815543} |
|||
m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068} |
|||
m_LocalPosition: {x: 0, y: 0, z: 100} |
|||
m_LocalScale: {x: 0.01, y: 100, z: 0.01} |
|||
m_Children: [] |
|||
m_Father: {fileID: 3282145534469213579} |
|||
m_RootOrder: 0 |
|||
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0} |
|||
--- !u!33 &6833705460578319375 |
|||
MeshFilter: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 795713508893815543} |
|||
m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0} |
|||
--- !u!23 &4622826133050988356 |
|||
MeshRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 795713508893815543} |
|||
m_Enabled: 1 |
|||
m_CastShadows: 1 |
|||
m_ReceiveShadows: 1 |
|||
m_DynamicOccludee: 1 |
|||
m_MotionVectors: 1 |
|||
m_LightProbeUsage: 1 |
|||
m_ReflectionProbeUsage: 1 |
|||
m_RenderingLayerMask: 1 |
|||
m_RendererPriority: 0 |
|||
m_Materials: |
|||
- {fileID: 2100000, guid: d80c1a202911a4a37a3da59992876dfc, type: 2} |
|||
m_StaticBatchInfo: |
|||
firstSubMesh: 0 |
|||
subMeshCount: 0 |
|||
m_StaticBatchRoot: {fileID: 0} |
|||
m_ProbeAnchor: {fileID: 0} |
|||
m_LightProbeVolumeOverride: {fileID: 0} |
|||
m_ScaleInLightmap: 1 |
|||
m_ReceiveGI: 1 |
|||
m_PreserveUVs: 0 |
|||
m_IgnoreNormalsForChartDetection: 0 |
|||
m_ImportantGI: 0 |
|||
m_StitchLightmapSeams: 1 |
|||
m_SelectedEditorRenderState: 3 |
|||
m_MinimumChartSize: 4 |
|||
m_AutoUVMaxDistance: 0.5 |
|||
m_AutoUVMaxAngle: 89 |
|||
m_LightmapParameters: {fileID: 0} |
|||
m_SortingLayerID: 0 |
|||
m_SortingLayer: 0 |
|||
m_SortingOrder: 0 |
|||
--- !u!136 &7010878674475661216 |
|||
CapsuleCollider: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 795713508893815543} |
|||
m_Material: {fileID: 0} |
|||
m_IsTrigger: 0 |
|||
m_Enabled: 1 |
|||
m_Radius: 0.5000001 |
|||
m_Height: 2 |
|||
m_Direction: 1 |
|||
m_Center: {x: 0.000000059604645, y: 0, z: -0.00000008940697} |
|||
--- !u!1 &1529176408204727125 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 3282145534469213579} |
|||
m_Layer: 0 |
|||
m_Name: FixationRayPrefab |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!4 &3282145534469213579 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1529176408204727125} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: 0} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: |
|||
- {fileID: 4175560679010963632} |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 0 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|
|||
fileFormatVersion: 2 |
|||
guid: 8339cb70cc6014347bd14cfea9e60601 |
|||
PrefabImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using UnityEngine.XR.ARFoundation; |
|||
using UnityEngine.XR.ARSubsystems; |
|||
|
|||
/// <summary>
|
|||
/// Visualizes the eye gaze position in face space for an <see cref="ARFace"/>.
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// Face space is the space where the origin is the transform of an <see cref="ARFace"/>.
|
|||
/// </remarks>
|
|||
[RequireComponent(typeof(ARFace))] |
|||
public class FixationPoint2DVisualizer : MonoBehaviour |
|||
{ |
|||
[SerializeField] |
|||
GameObject m_GUIFixationReticlePrefab; |
|||
|
|||
public GameObject fixationReticlePrefab |
|||
{ |
|||
get => m_GUIFixationReticlePrefab; |
|||
set => m_GUIFixationReticlePrefab = value; |
|||
} |
|||
GameObject m_FixationReticleGameObject; |
|||
|
|||
Canvas m_Canvas; |
|||
ARFace m_Face; |
|||
XRFaceSubsystem m_FaceSubsystem; |
|||
|
|||
void Awake() |
|||
{ |
|||
m_Face = GetComponent<ARFace>(); |
|||
} |
|||
|
|||
void GetOrCreateEyeGameObjects() |
|||
{ |
|||
var canvas = FindObjectOfType<Canvas>(); |
|||
if (m_Face.fixationPointTransform != null && canvas != null && m_FixationReticleGameObject == null) |
|||
{ |
|||
m_FixationReticleGameObject = Instantiate(m_GUIFixationReticlePrefab, canvas.transform); |
|||
} |
|||
} |
|||
|
|||
void SetVisible(bool visible) |
|||
{ |
|||
if (m_FixationReticleGameObject != null) |
|||
m_FixationReticleGameObject.SetActive(visible); |
|||
} |
|||
|
|||
void UpdateVisibility() |
|||
{ |
|||
var visible = |
|||
enabled && |
|||
(m_Face.trackingState == TrackingState.Tracking) && |
|||
m_FaceSubsystem.SubsystemDescriptor.supportsEyeTracking && |
|||
(ARSession.state > ARSessionState.Ready); |
|||
|
|||
SetVisible(visible); |
|||
} |
|||
|
|||
void OnEnable() |
|||
{ |
|||
var faceManager = FindObjectOfType<ARFaceManager>(); |
|||
if (faceManager != null) |
|||
{ |
|||
m_FaceSubsystem = (XRFaceSubsystem)faceManager.subsystem; |
|||
} |
|||
UpdateVisibility(); |
|||
m_Face.updated += OnUpdated; |
|||
} |
|||
|
|||
void OnUpdated(ARFaceUpdatedEventArgs eventArgs) |
|||
{ |
|||
GetOrCreateEyeGameObjects(); |
|||
UpdateVisibility(); |
|||
UpdateScreenReticle(); |
|||
} |
|||
|
|||
void UpdateScreenReticle() |
|||
{ |
|||
var mainCamera = Camera.main; |
|||
|
|||
var fixationInViewSpace = mainCamera.WorldToViewportPoint(m_Face.fixationPointTransform.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); |
|||
|
|||
if (m_FixationReticleGameObject != null) |
|||
{ |
|||
m_FixationReticleGameObject.GetComponent<RectTransform>().anchoredPosition3D = mainCamera.ViewportToScreenPoint(mirrorFixationInView); |
|||
} |
|||
} |
|||
|
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: c15242b4b6e064d8ead61c1e4c1b8be7 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: |
|||
- m_GUIFixationReticlePrefab: {fileID: 5180915313586242672, guid: a14db57d4a388438285ebba933990962, |
|||
type: 3} |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using UnityEngine.XR.ARFoundation; |
|||
using UnityEngine.XR.ARSubsystems; |
|||
|
|||
/// <summary>
|
|||
/// Visualizes the eye gaze position in face space for an <see cref="ARFace"/>.
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// Face space is the space where the origin is the transform of an <see cref="ARFace"/>.
|
|||
/// </remarks>
|
|||
[RequireComponent(typeof(ARFace))] |
|||
public class FixationPoint3DVisualizer : MonoBehaviour |
|||
{ |
|||
[SerializeField] |
|||
GameObject m_FixationPointPrefab; |
|||
|
|||
public GameObject fixationPointPrefab |
|||
{ |
|||
get => m_FixationPointPrefab; |
|||
set => m_FixationPointPrefab = value; |
|||
} |
|||
|
|||
GameObject m_FixationPointGameObject; |
|||
|
|||
ARFace m_Face; |
|||
XRFaceSubsystem m_FaceSubsystem; |
|||
|
|||
void Awake() |
|||
{ |
|||
m_Face = GetComponent<ARFace>(); |
|||
} |
|||
|
|||
void GetOrCreateEyeGameObjects() |
|||
{ |
|||
if (m_FixationPointGameObject == null && m_Face.fixationPointTransform != null) |
|||
{ |
|||
m_FixationPointGameObject = Instantiate(m_FixationPointPrefab, m_Face.transform); |
|||
m_FixationPointGameObject.SetActive(false); |
|||
} |
|||
} |
|||
|
|||
void SetVisible(bool visible) |
|||
{ |
|||
if (m_FixationPointGameObject != null) |
|||
m_FixationPointGameObject.SetActive(visible); |
|||
} |
|||
|
|||
void UpdateVisibility() |
|||
{ |
|||
var visible = |
|||
enabled && |
|||
(m_Face.trackingState == TrackingState.Tracking) && |
|||
m_FaceSubsystem.SubsystemDescriptor.supportsEyeTracking && |
|||
(ARSession.state > ARSessionState.Ready); |
|||
|
|||
SetVisible(visible); |
|||
} |
|||
|
|||
void OnEnable() |
|||
{ |
|||
var faceManager = FindObjectOfType<ARFaceManager>(); |
|||
if (faceManager != null) |
|||
{ |
|||
m_FaceSubsystem = (XRFaceSubsystem)faceManager.subsystem; |
|||
} |
|||
UpdateVisibility(); |
|||
m_Face.updated += OnUpdated; |
|||
} |
|||
|
|||
void OnUpdated(ARFaceUpdatedEventArgs eventArgs) |
|||
{ |
|||
GetOrCreateEyeGameObjects(); |
|||
UpdateVisibility(); |
|||
UpdateFixationPoint(); |
|||
} |
|||
|
|||
void UpdateFixationPoint() |
|||
{ |
|||
if (m_FixationPointGameObject != null) |
|||
{ |
|||
m_FixationPointGameObject.transform.LookAt(m_Face.fixationPointTransform.position); |
|||
} |
|||
} |
|||
|
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 84e9e36f641444746b0c94dcd4bb4518 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: |
|||
- m_FixationPointPrefab: {fileID: 1529176408204727125, guid: 8339cb70cc6014347bd14cfea9e60601, |
|||
type: 3} |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 80ffce31fe5404f1c91aa768d2cb33e8 |
|||
TextureImporter: |
|||
internalIDToNameTable: [] |
|||
externalObjects: {} |
|||
serializedVersion: 10 |
|||
mipmaps: |
|||
mipMapMode: 0 |
|||
enableMipMap: 1 |
|||
sRGBTexture: 1 |
|||
linearTexture: 0 |
|||
fadeOut: 0 |
|||
borderMipMap: 0 |
|||
mipMapsPreserveCoverage: 0 |
|||
alphaTestReferenceValue: 0.5 |
|||
mipMapFadeDistanceStart: 1 |
|||
mipMapFadeDistanceEnd: 3 |
|||
bumpmap: |
|||
convertToNormalMap: 0 |
|||
externalNormalMap: 0 |
|||
heightScale: 0.25 |
|||
normalMapFilter: 0 |
|||
isReadable: 0 |
|||
streamingMipmaps: 0 |
|||
streamingMipmapsPriority: 0 |
|||
grayScaleToAlpha: 0 |
|||
generateCubemap: 6 |
|||
cubemapConvolution: 0 |
|||
seamlessCubemap: 0 |
|||
textureFormat: 1 |
|||
maxTextureSize: 2048 |
|||
textureSettings: |
|||
serializedVersion: 2 |
|||
filterMode: -1 |
|||
aniso: -1 |
|||
mipBias: -100 |
|||
wrapU: -1 |
|||
wrapV: -1 |
|||
wrapW: -1 |
|||
nPOTScale: 1 |
|||
lightmap: 0 |
|||
compressionQuality: 50 |
|||
spriteMode: 0 |
|||
spriteExtrude: 1 |
|||
spriteMeshType: 1 |
|||
alignment: 0 |
|||
spritePivot: {x: 0.5, y: 0.5} |
|||
spritePixelsToUnits: 100 |
|||
spriteBorder: {x: 0, y: 0, z: 0, w: 0} |
|||
spriteGenerateFallbackPhysicsShape: 1 |
|||
alphaUsage: 1 |
|||
alphaIsTransparency: 0 |
|||
spriteTessellationDetail: -1 |
|||
textureType: 0 |
|||
textureShape: 1 |
|||
singleChannelComponent: 0 |
|||
maxTextureSizeSet: 0 |
|||
compressionQualitySet: 0 |
|||
textureFormatSet: 0 |
|||
platformSettings: |
|||
- serializedVersion: 3 |
|||
buildTarget: DefaultTexturePlatform |
|||
maxTextureSize: 2048 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
forceMaximumCompressionQuality_BC6H_BC7: 0 |
|||
spriteSheet: |
|||
serializedVersion: 2 |
|||
sprites: [] |
|||
outline: [] |
|||
physicsShape: [] |
|||
bones: [] |
|||
spriteID: |
|||
internalID: 0 |
|||
vertices: [] |
|||
indices: |
|||
edges: [] |
|||
weights: [] |
|||
secondaryTextures: [] |
|||
spritePackingTag: |
|||
pSDRemoveMatte: 0 |
|||
pSDShowRemoveMatteOption: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 84e9e36f641444746b0c94dcd4bb4518 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using UnityEngine.XR.ARFoundation; |
|||
using UnityEngine.XR.ARSubsystems; |
|||
|
|||
/// <summary>
|
|||
/// Visualizes the eye gaze position in face space for an <see cref="ARFace"/>.
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// Face space is the space where the origin is the transform of an <see cref="ARFace"/>.
|
|||
/// </remarks>
|
|||
[RequireComponent(typeof(ARFace))] |
|||
public class FixationPointVisualizer : MonoBehaviour |
|||
{ |
|||
[SerializeField] |
|||
GameObject m_FixationPointPrefab; |
|||
|
|||
[SerializeField] |
|||
GameObject m_GUIFixationReticlePrefab; |
|||
|
|||
public GameObject fixationPointPrefab |
|||
{ |
|||
get => m_FixationPointPrefab; |
|||
set => m_FixationPointPrefab = value; |
|||
} |
|||
|
|||
public GameObject fixationReticlePrefab |
|||
{ |
|||
get => m_GUIFixationReticlePrefab; |
|||
set => m_GUIFixationReticlePrefab = value; |
|||
} |
|||
|
|||
GameObject m_FixationPointGameObject; |
|||
GameObject m_FixationReticleGameObject; |
|||
|
|||
Canvas m_Canvas; |
|||
ARFace m_Face; |
|||
XRFaceSubsystem m_FaceSubsystem; |
|||
|
|||
void Awake() |
|||
{ |
|||
m_Face = GetComponent<ARFace>(); |
|||
} |
|||
|
|||
void GetOrCreateEyeGameObjects() |
|||
{ |
|||
if (m_FixationPointGameObject == null && m_Face.fixationPointTransform != null) |
|||
{ |
|||
m_FixationPointGameObject = Instantiate(m_FixationPointPrefab, m_Face.fixationPointTransform); |
|||
m_FixationPointGameObject.SetActive(false); |
|||
|
|||
if (FindObjectOfType<Canvas>() != null && m_FixationReticleGameObject == null) |
|||
{ |
|||
var canvas = FindObjectOfType<Canvas>(); |
|||
Debug.Log("Found a canvas"); |
|||
m_FixationReticleGameObject = Instantiate(m_GUIFixationReticlePrefab, canvas.transform); |
|||
} |
|||
} |
|||
} |
|||
|
|||
void SetVisible(bool visible) |
|||
{ |
|||
if (m_FixationPointGameObject != null) |
|||
m_FixationPointGameObject.SetActive(visible); |
|||
|
|||
if (m_FixationReticleGameObject != null) |
|||
m_FixationReticleGameObject.SetActive(visible); |
|||
} |
|||
|
|||
void UpdateVisibility() |
|||
{ |
|||
var visible = |
|||
enabled && |
|||
(m_Face.trackingState == TrackingState.Tracking) && |
|||
m_FaceSubsystem.SubsystemDescriptor.supportsEyeTracking && |
|||
(ARSession.state > ARSessionState.Ready); |
|||
|
|||
SetVisible(visible); |
|||
} |
|||
|
|||
void OnEnable() |
|||
{ |
|||
var faceManager = FindObjectOfType<ARFaceManager>(); |
|||
if (faceManager != null) |
|||
{ |
|||
m_FaceSubsystem = (XRFaceSubsystem)faceManager.subsystem; |
|||
} |
|||
UpdateVisibility(); |
|||
m_Face.updated += OnUpdated; |
|||
} |
|||
|
|||
void OnUpdated(ARFaceUpdatedEventArgs eventArgs) |
|||
{ |
|||
GetOrCreateEyeGameObjects(); |
|||
UpdateVisibility(); |
|||
UpdateFixationPoint(); |
|||
UpdateScreenReticle(); |
|||
} |
|||
|
|||
void UpdateFixationPoint() |
|||
{ |
|||
if (m_FixationPointGameObject != null) |
|||
{ |
|||
// This is needed to update the rotation to better match the where of the fixation point
|
|||
// Debug.Log("");
|
|||
} |
|||
} |
|||
|
|||
void UpdateScreenReticle() |
|||
{ |
|||
var mainCamera = Camera.main; |
|||
|
|||
var fixationInViewSpace = mainCamera.WorldToViewportPoint(m_Face.fixationPointTransform.position); |
|||
var mirrorFixationInView = new Vector3(1 - fixationInViewSpace.x, 1 - fixationInViewSpace.y, fixationInViewSpace.z); |
|||
|
|||
if (m_FixationReticleGameObject != null) |
|||
{ |
|||
m_FixationReticleGameObject.GetComponent<RectTransform>().anchoredPosition3D = mainCamera.ViewportToScreenPoint(mirrorFixationInView); |
|||
} |
|||
} |
|||
|
|||
} |
|
|||
Shader "Custom/DoubleSidedSurfaceShader" |
|||
{ |
|||
Properties |
|||
{ |
|||
_Color ("Color", Color) = (1,1,1,1) |
|||
_MainTex ("Albedo (RGB)", 2D) = "white" {} |
|||
_Glossiness ("Smoothness", Range(0,1)) = 0.5 |
|||
_Metallic ("Metallic", Range(0,1)) = 0.0 |
|||
} |
|||
SubShader |
|||
{ |
|||
Tags { "RenderType"="Opaque" } |
|||
LOD 200 |
|||
|
|||
CGPROGRAM |
|||
// Physically based Standard lighting model, and enable shadows on all light types |
|||
#pragma surface surf Standard fullforwardshadows |
|||
|
|||
// Use shader model 3.0 target, to get nicer looking lighting |
|||
#pragma target 3.0 |
|||
|
|||
sampler2D _MainTex; |
|||
|
|||
struct Input |
|||
{ |
|||
float2 uv_MainTex; |
|||
}; |
|||
|
|||
half _Glossiness; |
|||
half _Metallic; |
|||
fixed4 _Color; |
|||
|
|||
// Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader. |
|||
// See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing. |
|||
// #pragma instancing_options assumeuniformscaling |
|||
UNITY_INSTANCING_BUFFER_START(Props) |
|||
// put more per-instance properties here |
|||
UNITY_INSTANCING_BUFFER_END(Props) |
|||
|
|||
void surf (Input IN, inout SurfaceOutputStandard o) |
|||
{ |
|||
// Albedo comes from a texture tinted by color |
|||
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color; |
|||
o.Albedo = c.rgb; |
|||
// Metallic and smoothness come from slider variables |
|||
o.Metallic = _Metallic; |
|||
o.Smoothness = _Glossiness; |
|||
o.Alpha = c.a; |
|||
} |
|||
ENDCG |
|||
} |
|||
FallBack "Diffuse" |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 3a5099ac491614be58256fbf10e331d5 |
|||
ShaderImporter: |
|||
externalObjects: {} |
|||
defaultTextures: [] |
|||
nonModifiableTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
|
|||
public class MoveReticle : MonoBehaviour |
|||
{ |
|||
// Start is called before the first frame update
|
|||
void Start() |
|||
{ |
|||
|
|||
} |
|||
|
|||
// Update is called once per frame
|
|||
void Update() |
|||
{ |
|||
var rectTransform = GetComponent<RectTransform>(); |
|||
if (rectTransform != null) |
|||
{ |
|||
Vector2 ancvecc = rectTransform.anchoredPosition; |
|||
rectTransform.anchoredPosition = new Vector2(ancvecc.x + 1, ancvecc.y + 1); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 8ac04636e1b7b4cb2ba1ed320dad266d |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue