Prepare for 1.2 release
- Rename VRInteractable - Update Readme - Adjust demo object positions - Make gun burst
Showing
6 changed files
with
105 additions
and
58 deletions
| ... | @@ -38,7 +38,7 @@ RenderSettings: | ... | @@ -38,7 +38,7 @@ RenderSettings: |
| 38 | m_ReflectionIntensity: 1 | 38 | m_ReflectionIntensity: 1 |
| 39 | m_CustomReflection: {fileID: 0} | 39 | m_CustomReflection: {fileID: 0} |
| 40 | m_Sun: {fileID: 0} | 40 | m_Sun: {fileID: 0} |
| 41 | - m_IndirectSpecularColor: {r: 0.18028364, g: 0.22571398, b: 0.30692267, a: 1} | 41 | + m_IndirectSpecularColor: {r: 0.18028378, g: 0.22571412, b: 0.30692285, a: 1} |
| 42 | --- !u!157 &3 | 42 | --- !u!157 &3 |
| 43 | LightmapSettings: | 43 | LightmapSettings: |
| 44 | m_ObjectHideFlags: 0 | 44 | m_ObjectHideFlags: 0 |
| ... | @@ -4254,7 +4254,7 @@ Transform: | ... | @@ -4254,7 +4254,7 @@ Transform: |
| 4254 | m_LocalPosition: {x: 0, y: 0, z: 0} | 4254 | m_LocalPosition: {x: 0, y: 0, z: 0} |
| 4255 | m_LocalScale: {x: 1, y: 1, z: 1} | 4255 | m_LocalScale: {x: 1, y: 1, z: 1} |
| 4256 | m_Children: | 4256 | m_Children: |
| 4257 | - - {fileID: 1979091570} | 4257 | + - {fileID: 1979091566} |
| 4258 | - {fileID: 869103185} | 4258 | - {fileID: 869103185} |
| 4259 | - {fileID: 313616115} | 4259 | - {fileID: 313616115} |
| 4260 | m_Father: {fileID: 0} | 4260 | m_Father: {fileID: 0} |
| ... | @@ -4921,9 +4921,9 @@ GameObject: | ... | @@ -4921,9 +4921,9 @@ GameObject: |
| 4921 | - component: {fileID: 1179877082} | 4921 | - component: {fileID: 1179877082} |
| 4922 | - component: {fileID: 1179877084} | 4922 | - component: {fileID: 1179877084} |
| 4923 | - component: {fileID: 1179877083} | 4923 | - component: {fileID: 1179877083} |
| 4924 | + - component: {fileID: 1179877088} | ||
| 4924 | - component: {fileID: 1179877085} | 4925 | - component: {fileID: 1179877085} |
| 4925 | - component: {fileID: 1179877086} | 4926 | - component: {fileID: 1179877086} |
| 4926 | - - component: {fileID: 1179877088} | ||
| 4927 | m_Layer: 5 | 4927 | m_Layer: 5 |
| 4928 | m_Name: Interatable UI Image | 4928 | m_Name: Interatable UI Image |
| 4929 | m_TagString: Untagged | 4929 | m_TagString: Untagged |
| ... | @@ -12952,11 +12952,11 @@ Prefab: | ... | @@ -12952,11 +12952,11 @@ Prefab: |
| 12952 | objectReference: {fileID: 0} | 12952 | objectReference: {fileID: 0} |
| 12953 | - target: {fileID: 4323484768405676, guid: 2b7e4fd4c75ce4919831f6c6dc401deb, type: 2} | 12953 | - target: {fileID: 4323484768405676, guid: 2b7e4fd4c75ce4919831f6c6dc401deb, type: 2} |
| 12954 | propertyPath: m_LocalPosition.y | 12954 | propertyPath: m_LocalPosition.y |
| 12955 | - value: -0.003309071 | 12955 | + value: 0.696 |
| 12956 | objectReference: {fileID: 0} | 12956 | objectReference: {fileID: 0} |
| 12957 | - target: {fileID: 4323484768405676, guid: 2b7e4fd4c75ce4919831f6c6dc401deb, type: 2} | 12957 | - target: {fileID: 4323484768405676, guid: 2b7e4fd4c75ce4919831f6c6dc401deb, type: 2} |
| 12958 | propertyPath: m_LocalPosition.z | 12958 | propertyPath: m_LocalPosition.z |
| 12959 | - value: 1.764 | 12959 | + value: 4.218 |
| 12960 | objectReference: {fileID: 0} | 12960 | objectReference: {fileID: 0} |
| 12961 | - target: {fileID: 4323484768405676, guid: 2b7e4fd4c75ce4919831f6c6dc401deb, type: 2} | 12961 | - target: {fileID: 4323484768405676, guid: 2b7e4fd4c75ce4919831f6c6dc401deb, type: 2} |
| 12962 | propertyPath: m_LocalRotation.x | 12962 | propertyPath: m_LocalRotation.x |
| ... | @@ -12978,6 +12978,10 @@ Prefab: | ... | @@ -12978,6 +12978,10 @@ Prefab: |
| 12978 | propertyPath: m_RootOrder | 12978 | propertyPath: m_RootOrder |
| 12979 | value: 2 | 12979 | value: 2 |
| 12980 | objectReference: {fileID: 0} | 12980 | objectReference: {fileID: 0} |
| 12981 | + - target: {fileID: 1514860329309504, guid: 2b7e4fd4c75ce4919831f6c6dc401deb, type: 2} | ||
| 12982 | + propertyPath: m_Name | ||
| 12983 | + value: Target Cube | ||
| 12984 | + objectReference: {fileID: 0} | ||
| 12981 | m_RemovedComponents: [] | 12985 | m_RemovedComponents: [] |
| 12982 | m_ParentPrefab: {fileID: 100100000, guid: 2b7e4fd4c75ce4919831f6c6dc401deb, type: 2} | 12986 | m_ParentPrefab: {fileID: 100100000, guid: 2b7e4fd4c75ce4919831f6c6dc401deb, type: 2} |
| 12983 | m_IsPrefabParent: 0 | 12987 | m_IsPrefabParent: 0 |
| ... | @@ -13173,7 +13177,7 @@ GameObject: | ... | @@ -13173,7 +13177,7 @@ GameObject: |
| 13173 | m_PrefabInternal: {fileID: 0} | 13177 | m_PrefabInternal: {fileID: 0} |
| 13174 | serializedVersion: 5 | 13178 | serializedVersion: 5 |
| 13175 | m_Component: | 13179 | m_Component: |
| 13176 | - - component: {fileID: 1979091570} | 13180 | + - component: {fileID: 1979091566} |
| 13177 | - component: {fileID: 1979091568} | 13181 | - component: {fileID: 1979091568} |
| 13178 | - component: {fileID: 1979091567} | 13182 | - component: {fileID: 1979091567} |
| 13179 | - component: {fileID: 1979091569} | 13183 | - component: {fileID: 1979091569} |
| ... | @@ -13196,12 +13200,25 @@ MonoBehaviour: | ... | @@ -13196,12 +13200,25 @@ MonoBehaviour: |
| 13196 | m_Script: {fileID: 11500000, guid: 2ed6c285bcc774470840d1967056436d, type: 3} | 13200 | m_Script: {fileID: 11500000, guid: 2ed6c285bcc774470840d1967056436d, type: 3} |
| 13197 | m_Name: | 13201 | m_Name: |
| 13198 | m_EditorClassIdentifier: | 13202 | m_EditorClassIdentifier: |
| 13199 | - m_Camera: {fileID: 1979091570} | 13203 | + m_Camera: {fileID: 1979091566} |
| 13200 | m_ExclusionLayers: | 13204 | m_ExclusionLayers: |
| 13201 | serializedVersion: 2 | 13205 | serializedVersion: 2 |
| 13202 | m_Bits: 4 | 13206 | m_Bits: 4 |
| 13203 | m_RayLength: 500 | 13207 | m_RayLength: 500 |
| 13204 | m_ShowDebugRay: 1 | 13208 | m_ShowDebugRay: 1 |
| 13209 | +--- !u!4 &1979091566 | ||
| 13210 | +Transform: | ||
| 13211 | + m_ObjectHideFlags: 0 | ||
| 13212 | + m_PrefabParentObject: {fileID: 0} | ||
| 13213 | + m_PrefabInternal: {fileID: 0} | ||
| 13214 | + m_GameObject: {fileID: 1979091564} | ||
| 13215 | + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} | ||
| 13216 | + m_LocalPosition: {x: 0, y: 0, z: 0} | ||
| 13217 | + m_LocalScale: {x: 1, y: 1, z: 1} | ||
| 13218 | + m_Children: [] | ||
| 13219 | + m_Father: {fileID: 805204565} | ||
| 13220 | + m_RootOrder: 0 | ||
| 13221 | + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||
| 13205 | --- !u!124 &1979091567 | 13222 | --- !u!124 &1979091567 |
| 13206 | Behaviour: | 13223 | Behaviour: |
| 13207 | m_ObjectHideFlags: 0 | 13224 | m_ObjectHideFlags: 0 |
| ... | @@ -13254,24 +13271,6 @@ AudioListener: | ... | @@ -13254,24 +13271,6 @@ AudioListener: |
| 13254 | m_PrefabInternal: {fileID: 0} | 13271 | m_PrefabInternal: {fileID: 0} |
| 13255 | m_GameObject: {fileID: 1979091564} | 13272 | m_GameObject: {fileID: 1979091564} |
| 13256 | m_Enabled: 1 | 13273 | m_Enabled: 1 |
| 13257 | ---- !u!224 &1979091570 | ||
| 13258 | -RectTransform: | ||
| 13259 | - m_ObjectHideFlags: 0 | ||
| 13260 | - m_PrefabParentObject: {fileID: 0} | ||
| 13261 | - m_PrefabInternal: {fileID: 0} | ||
| 13262 | - m_GameObject: {fileID: 1979091564} | ||
| 13263 | - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} | ||
| 13264 | - m_LocalPosition: {x: 0, y: 0, z: 0} | ||
| 13265 | - m_LocalScale: {x: 1, y: 1, z: 1} | ||
| 13266 | - m_Children: [] | ||
| 13267 | - m_Father: {fileID: 805204565} | ||
| 13268 | - m_RootOrder: 0 | ||
| 13269 | - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||
| 13270 | - m_AnchorMin: {x: 0.5, y: 0.5} | ||
| 13271 | - m_AnchorMax: {x: 0.5, y: 0.5} | ||
| 13272 | - m_AnchoredPosition: {x: 0, y: 0} | ||
| 13273 | - m_SizeDelta: {x: 100, y: 100} | ||
| 13274 | - m_Pivot: {x: 0.5, y: 0.5} | ||
| 13275 | --- !u!1 &1998395652 | 13274 | --- !u!1 &1998395652 |
| 13276 | GameObject: | 13275 | GameObject: |
| 13277 | m_ObjectHideFlags: 0 | 13276 | m_ObjectHideFlags: 0 | ... | ... |
| ... | @@ -12,7 +12,7 @@ public class GunController : MonoBehaviour { | ... | @@ -12,7 +12,7 @@ public class GunController : MonoBehaviour { |
| 12 | 12 | ||
| 13 | void Update() | 13 | void Update() |
| 14 | { | 14 | { |
| 15 | - if(VRInput.GetVRButtonDown(VRInput.Button.RightIndex)) | 15 | + if(VRInput.GetVRButton(VRInput.Button.RightIndex)) |
| 16 | { | 16 | { |
| 17 | gun.Fire(); | 17 | gun.Fire(); |
| 18 | } | 18 | } | ... | ... |
| ... | @@ -13,8 +13,8 @@ public class VREyeRaycaster : MonoBehaviour | ... | @@ -13,8 +13,8 @@ public class VREyeRaycaster : MonoBehaviour |
| 13 | [SerializeField] private bool m_ShowDebugRay; // Optionally show the debug ray. [SerializeField] private float m_RayLength = 500f; // How far into the scene the ray is cast. | 13 | [SerializeField] private bool m_ShowDebugRay; // Optionally show the debug ray. [SerializeField] private float m_RayLength = 500f; // How far into the scene the ray is cast. |
| 14 | 14 | ||
| 15 | 15 | ||
| 16 | - private VRInteratable m_CurrentInteractible; //The current interactive item | 16 | + private VRInteractable m_CurrentInteractible; //The current interactive item |
| 17 | - private VRInteratable m_LastInteractible; //The last interactive item | 17 | + private VRInteractable m_LastInteractible; //The last interactive item |
| 18 | 18 | ||
| 19 | 19 | ||
| 20 | void Update() | 20 | void Update() |
| ... | @@ -47,7 +47,7 @@ public class VREyeRaycaster : MonoBehaviour | ... | @@ -47,7 +47,7 @@ public class VREyeRaycaster : MonoBehaviour |
| 47 | // Do the raycast forweards to see if we hit an interactive item | 47 | // Do the raycast forweards to see if we hit an interactive item |
| 48 | if (Physics.Raycast(ray, out hit, m_RayLength, ~m_ExclusionLayers)) | 48 | if (Physics.Raycast(ray, out hit, m_RayLength, ~m_ExclusionLayers)) |
| 49 | { | 49 | { |
| 50 | - VRInteratable interactible = hit.collider.GetComponent<VRInteratable>(); //attempt to get the VRInteractiveItem on the hit object | 50 | + VRInteractable interactible = hit.collider.GetComponent<VRInteractable>(); //attempt to get the VRInteractiveItem on the hit object |
| 51 | m_CurrentInteractible = interactible; | 51 | m_CurrentInteractible = interactible; |
| 52 | 52 | ||
| 53 | // If we hit an interactive item and it's not the same as the last interactive item, then call Over | 53 | // If we hit an interactive item and it's not the same as the last interactive item, then call Over | ... | ... |
| ... | @@ -3,7 +3,7 @@ using System.Collections.Generic; | ... | @@ -3,7 +3,7 @@ using System.Collections.Generic; |
| 3 | using UnityEngine; | 3 | using UnityEngine; |
| 4 | using UnityEngine.Events; | 4 | using UnityEngine.Events; |
| 5 | 5 | ||
| 6 | -public class VRInteratable : MonoBehaviour { | 6 | +public class VRInteractable : MonoBehaviour { |
| 7 | 7 | ||
| 8 | [SerializeField] | 8 | [SerializeField] |
| 9 | private UnityEvent onClick; | 9 | private UnityEvent onClick; | ... | ... |
| ... | @@ -22,9 +22,13 @@ Oculus VR 과 HTC Vive (Steam VR) 에 모두 대응합니다. | ... | @@ -22,9 +22,13 @@ Oculus VR 과 HTC Vive (Steam VR) 에 모두 대응합니다. |
| 22 | ### VR 트래킹 기능 | 22 | ### VR 트래킹 기능 |
| 23 | - 현실 부위 1:1 트래킹 | 23 | - 현실 부위 1:1 트래킹 |
| 24 | - VR 컨트롤러 입력 대응 함수 제공 | 24 | - VR 컨트롤러 입력 대응 함수 제공 |
| 25 | -- 스테이셔너리 자동 키 설정 | ||
| 26 | - 간결한 코드와 높은 확장성 | 25 | - 간결한 코드와 높은 확장성 |
| 27 | 26 | ||
| 27 | +### VR 인터렉션과 VR UI | ||
| 28 | +- VR 카메라가 응시하는 사물과 상호작용 가능 | ||
| 29 | +- 상호작용 이벤트를 제공 | ||
| 30 | +- 상호작용 UI 예제 첨부 | ||
| 31 | + | ||
| 28 | ### 건 슈터 (FPS Shooter) 기능 | 32 | ### 건 슈터 (FPS Shooter) 기능 |
| 29 | - 단발/연사 | 33 | - 단발/연사 |
| 30 | - 피탄 이펙트 | 34 | - 피탄 이펙트 |
| ... | @@ -35,9 +39,23 @@ Oculus VR 과 HTC Vive (Steam VR) 에 모두 대응합니다. | ... | @@ -35,9 +39,23 @@ Oculus VR 과 HTC Vive (Steam VR) 에 모두 대응합니다. |
| 35 | - Gun.Reload - 장전 | 39 | - Gun.Reload - 장전 |
| 36 | - Gun.Fire - 발사 | 40 | - Gun.Fire - 발사 |
| 37 | 41 | ||
| 42 | + | ||
| 43 | + | ||
| 44 | +## 선행조건 ## | ||
| 45 | + | ||
| 46 | +유니티 Input Manager 에 OpenVR에 대응되는 Axes 이름이 지정되어 있어야 합니다.<br> | ||
| 47 | +각 스틱과 버튼에 대한 식별자는 [유니티 OpenVR 입력 테이블 문서](https://docs.unity3d.com/Manual/OpenVRControllers.html) 에서 찾을 수 있습니다. | ||
| 48 | + | ||
| 49 | + | ||
| 50 | +이 템플릿 프로젝트에는 해당 설정이 미리 지정되어 있으므로 별다른 설정을 요구하지는 않습니다.<br>미리 설정된 VR Input 테이블은 Edit > Proejct Settings > Input Manager 에서 확인할 수 있습니다. | ||
| 51 | + | ||
| 52 | +VR 컨트롤러에 대응하는 자세한 원리는 VRInput 스크립트의 주석에 있습니다. | ||
| 53 | + | ||
| 54 | + | ||
| 38 | ## 동작과 사용 방법 | 55 | ## 동작과 사용 방법 |
| 39 | 미리 만들어진 예제 씬을 참고하면 좋습니다. | 56 | 미리 만들어진 예제 씬을 참고하면 좋습니다. |
| 40 | 57 | ||
| 58 | + | ||
| 41 | ### 프리팹 Prefab | 59 | ### 프리팹 Prefab |
| 42 | 60 | ||
| 43 | 미리 만들어진 예제 프리팹을 제공합니다. | 61 | 미리 만들어진 예제 프리팹을 제공합니다. |
| ... | @@ -49,7 +67,7 @@ Oculus VR 과 HTC Vive (Steam VR) 에 모두 대응합니다. | ... | @@ -49,7 +67,7 @@ Oculus VR 과 HTC Vive (Steam VR) 에 모두 대응합니다. |
| 49 |  | 67 |  |
| 50 | 어떤 오브젝트든 VRControllerTracking 만 붙여주면, 현실의 VR 컨트롤러와 위치와 동기화됩니다. | 68 | 어떤 오브젝트든 VRControllerTracking 만 붙여주면, 현실의 VR 컨트롤러와 위치와 동기화됩니다. |
| 51 | 69 | ||
| 52 | - | 70 | + |
| 53 | 부착한 다음, 원하는 추적 부위를 지정해주세요. | 71 | 부착한 다음, 원하는 추적 부위를 지정해주세요. |
| 54 | 72 | ||
| 55 | 위치와 회전 동기화는 로컬 좌표계를 기준으로 합니다. | 73 | 위치와 회전 동기화는 로컬 좌표계를 기준으로 합니다. |
| ... | @@ -57,42 +75,80 @@ Oculus VR 과 HTC Vive (Steam VR) 에 모두 대응합니다. | ... | @@ -57,42 +75,80 @@ Oculus VR 과 HTC Vive (Steam VR) 에 모두 대응합니다. |
| 57 | 75 | ||
| 58 | ### VR 컨트롤러 입력 감지 | 76 | ### VR 컨트롤러 입력 감지 |
| 59 | 77 | ||
| 60 | -어떤 스크립트든 VRInputController 를 상속하면, VR 컨트롤러의 입력을 받을 수 있습니다. | 78 | +VRInput 를 통해 왼손과 오른손 VR 컨트롤러의 현재 입력을 확인할 수 있습니다. |
| 79 | + | ||
| 80 | +두가지 정적 함수를 제공합니다. | ||
| 81 | + | ||
| 82 | +- bool GetVRButtonDown(Button button) | ||
| 83 | + - VR 컨트롤러의 방아쇠 버튼을 막 누른 그 한 순간에만 true 를 반환 | ||
| 84 | + - 클릭이나 단발 사격을 구현할때 사용할 수 있습니다 | ||
| 85 | + | ||
| 86 | +- bool GetVRButton(Button button) | ||
| 87 | + - VR 컨트롤러의 방아쇠 버튼을 누르는 동안 지속적으로 true 를 반환 | ||
| 88 | + | ||
| 61 | 89 | ||
| 62 | -두가지 오버라이드 가능한 함수를 제공합니다. 이들은 VR 컨트롤러 입력이 감지되면 자동으로 호출됩니다. | 90 | +두 함수 모두 입력으로 방아쇠 버튼의 종류를 받습니다. |
| 63 | -- void OnIndexTriggerButton() - VR 컨트롤러 검지 방아쇠를 누르는 동안 발동 | 91 | +- LeftIndex: 왼손 VR 컨트롤러의 검지 방아쇠 |
| 64 | -- void OnGripTriggerButton() - VR 컨트롤러 쥐는 방아쇠를 누르는 동안 발동 | 92 | +- RightIndex: 오른손 VR 컨트롤러의 검지 방아쇠 |
| 93 | +- LeftGrip: 왼손 VR 컨트롤러의 그립(쥐는) 방아쇠 | ||
| 94 | +- RightGrip: 오른손 VR 컨트롤러의 그립(쥐는) 방아쇠 | ||
| 65 | 95 | ||
| 66 | -1. VRInputController 스크립트를 상속받습니다. | ||
| 67 | -2. 원하는 입력에 따라 위의 함수 중 하나를 오버라이드 합니다. | ||
| 68 | -3. 함수 내부에 입력에 대응할 동작을 구현합니다. | ||
| 69 | 96 | ||
| 70 | #### VR 입력 대응 예시 코드 | 97 | #### VR 입력 대응 예시 코드 |
| 71 | 98 | ||
| 72 | -예제의 GunController 스크립트는 VR 입력에 따라 Gun 을 제어하는 스크립트 입니다. | 99 | +예제의 GunController 스크립트는 VR 입력에 따라 Gun 을 제어하는 스크립트 입니다.<br> |
| 73 | -별다른 코드 없이, OnIndexTriggerButton 와 OnGripTriggerButton 를 오버라이드 하여 입력에 대응하고 있습니다. | 100 | +별다른 코드 없이, GetVRButtonDown 와 GetVRButton 으로 입력을 체크하여 총을 제어합니다. |
| 74 | 101 | ||
| 102 | +검지 방아쇠를 당기고 있는 동안 계속 총을 발사합니다.<br>그립 방아쇠는 Down 함수를 사용하여, 쥐는 그 한 순간에만 재장전을 합니다. | ||
| 75 | 103 | ||
| 76 | -~~~ | ||
| 77 | -public class GunController : VRInputController { | ||
| 78 | 104 | ||
| 105 | +~~~ | ||
| 79 | public Gun gun; | 106 | public Gun gun; |
| 80 | 107 | ||
| 81 | - public override void OnIndexTriggerButtonDown() | 108 | + void Update() |
| 109 | + { | ||
| 110 | + if(VRInput.GetVRButton(VRInput.Button.RightIndex)) | ||
| 82 | { | 111 | { |
| 83 | gun.Fire(); | 112 | gun.Fire(); |
| 84 | } | 113 | } |
| 85 | 114 | ||
| 86 | - public override void OnGripTriggerButtonDown() | 115 | + if(VRInput.GetVRButtonDown(VRInput.Button.RightGrip)) |
| 87 | { | 116 | { |
| 88 | gun.Reload(); | 117 | gun.Reload(); |
| 89 | } | 118 | } |
| 90 | -} | 119 | + } |
| 91 | ~~~ | 120 | ~~~ |
| 92 | 121 | ||
| 122 | +### VR 인터렉션과 VR UI ### | ||
| 123 | + | ||
| 124 | +VR에서 UI와 상호작용하는 예제가 데모에 있습니다.<br>상호작용 자체는 UI가 아니더라도, 콜라이더를 가진 다른 모든 오브젝트와도 가능합니다. | ||
| 125 | + | ||
| 126 | +데모의 VR UI Canvas 오브젝트에 있는, Interatable UI Image 를 플레이어가 응시하면 색이 바뀝니다.<br>다시 다른 곳을 바라보면 원래 색으로 돌아갑니다. 플레이어가 해당 오브젝트를 바라보는 상태에서 오른손 검지 방아쇠를 당기면 색이 무작위로 지정됩니다. | ||
| 127 | + | ||
| 128 | + | ||
| 129 | +#### 사용법 #### | ||
| 130 | + | ||
| 131 | +선행조건 | ||
| 132 | +- 레이캐스팅을 통해 감지하므로, 상호작용할 물체는 3D 콜라이더 컴포넌트를 가지고 있어야 합니다. | ||
| 133 | +- UI 오브젝트도 예외없이 3D 콜라이더를 가져야 합니다. | ||
| 134 | + | ||
| 135 | +절차 | ||
| 136 | + | ||
| 137 | +- 카메라 VREyeRaycaster 스크립트를 부착합니다.<br> | ||
| 138 | + - 해당 스크립트는 응시하고 있는 오브젝트가 가진 함수를 발동시킬 수 있습니다. | ||
| 139 | +- 인터렉션이 필요한 오브젝트에게 콜라이더를 부착합니다.<br> | ||
| 140 | +- 인터렉션할 오브젝트에게 VRInteractable 스크립트를 부착합니다.<br> | ||
| 141 | + - 이 스크립트는 세가지 유니티 이벤트를 제공합니다. 이들은 VREyeRaycaster에 의해 자동으로 발동됩니다. | ||
| 142 | + - OnClick: VR 오른손 컨트롤러의 검지 방아쇠를 클릭하면 발동됩니다. | ||
| 143 | + - OnVREyeEnter: VREyeRaycaster 를 가진 카메라의 시선 중심에 오브젝트가 들어오는 순간 발동됩니다. | ||
| 144 | + - OnVREyeExit: VREyeRaycaster 를 가진 카메라의 시선이 오브젝트를 벗어나는 순간 발동됩니다. | ||
| 145 | +- 원하는 유니티 이벤트의 슬롯을 추가하고, 연동할 함수를 등록합니다. | ||
| 146 | + | ||
| 147 | + | ||
| 93 | ### 건 슈터 Gun Shooter | 148 | ### 건 슈터 Gun Shooter |
| 94 | 캡슐화 되어있습니다. 그냥 프리팹을 가져다 쓰면 됩니다. | 149 | 캡슐화 되어있습니다. 그냥 프리팹을 가져다 쓰면 됩니다. |
| 95 |  | 150 |  |
| 151 | + | ||
| 96 | 외부 함수로 Gun.Fire 와 Gun.Reload 를 제공하여, 총을 쏘고 재장전 할 수 있습니다. | 152 | 외부 함수로 Gun.Fire 와 Gun.Reload 를 제공하여, 총을 쏘고 재장전 할 수 있습니다. |
| 97 | 153 | ||
| 98 | ### 총알 데미지 처리 | 154 | ### 총알 데미지 처리 |
| ... | @@ -116,20 +172,12 @@ public class HitCube : MonoBehaviour,IDamageable { | ... | @@ -116,20 +172,12 @@ public class HitCube : MonoBehaviour,IDamageable { |
| 116 | } | 172 | } |
| 117 | ~~~ | 173 | ~~~ |
| 118 | 174 | ||
| 119 | -### 이외의 기능들 ### | ||
| 120 | - | ||
| 121 | -작성중 | ||
| 122 | - | ||
| 123 | -## 기타 ## | ||
| 124 | 175 | ||
| 125 | -### VR 컨트롤러 입력 설정 | ||
| 126 | 176 | ||
| 127 | -VR 컨트롤러의 입력을 InputManager 에서 제어하는 방법은 VRInputController 와 https://github.com/IJEMIN/Unity-OpenVR-Power-Blade-Example 의 Readme 문서를 참고. | 177 | +# 크레딧과 연락처 |
| 128 | - | 178 | +I_Jemin |
| 129 | - | 179 | +- 메일: i_jemin@hotmail.com |
| 130 | - | 180 | +- 블로그: ijemin.com |
| 131 | -# 크레딧 | ||
| 132 | -I_Jemin (i_jemin@hotmail.com, ijemin.com) | ||
| 133 | 181 | ||
| 134 | # 기타 | 182 | # 기타 |
| 135 | 유니티 애셋 스토어에서 제공되는 무료 애셋을 사용하였습니다.<br> | 183 | 유니티 애셋 스토어에서 제공되는 무료 애셋을 사용하였습니다.<br> | ... | ... |
-
Please register or login to post a comment