Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
devwiki:vr [2022/06/29 17:24] – [VR Framework setup] ying | devwiki:vr [2022/07/02 03:57] (current) – [VR quick workflow] ying | ||
---|---|---|---|
Line 264: | Line 264: | ||
====== VR quick workflow ====== | ====== VR quick workflow ====== | ||
- | wip | + | VR quick setup |
+ | **initial setup** | ||
+ | - new project: build settings - android | ||
+ | - player settings: input: new inputs | ||
+ | - [add] package manager: install (alt+_) | ||
+ | * XR plugin management 4.2.1 | ||
+ | * XR interactive toolkit 2.0.2 + import Starter Asset | ||
+ | * oculus XR plugin: 1.12 | ||
+ | - player setting: | ||
+ | * xr plugin management: check oculus for both pc and android | ||
+ | - [add] import external package: | ||
+ | * Oculus Hands.unitypackage | ||
+ | * VR Tunnelling Pro.unitypackage | ||
+ | **input tweak** | ||
+ | - go Assets / Samples / XR Interaction toolkit / 2.0.2/ Starter | ||
+ | - [add] select XRI default left+right controller: (top button in inspector) "add to ActionBasedController default" | ||
+ | - [set] Project setting > Preset Manager: | ||
+ | * filter " | ||
+ | **Settings** | ||
+ | - Build settings: Android | ||
+ | * texture compression: | ||
+ | - Project setting: | ||
+ | * Quality: go option Medium: | ||
+ | * anistropic texture = disable | ||
+ | * anti alias = 4x | ||
+ | * shadow = disable | ||
+ | - Player setting: | ||
+ | * other : Dynamic Batching = true | ||
+ | * other : mini API = 23 | ||
+ | * prebake collision mesh = true | ||
+ | - audio setting: | ||
+ | * DSP buffet size = best latency | ||
+ | - Time setting: | ||
+ | * fixed timestep = 0.0138889 (1/72) | ||
+ | **MainScene** | ||
+ | - Name MainScene | ||
+ | - delete default cameras | ||
+ | - First directional light | ||
+ | * mode = realtime | ||
+ | * shadow = no shadow | ||
+ | - Second directional light | ||
+ | * mode = baked | ||
+ | * shadow = soft shadows | ||
+ | - layer: Teleport / Grab / Player | ||
+ | * project setting : physics : layer collision matrix > player not X grab | ||
+ | **XR Rig** | ||
+ | - [add] XR origin (action based) | ||
+ | * to layer " | ||
+ | * tracking origin mode = " | ||
+ | - inside XR origin: | ||
+ | * duplicate L/R controllers 2 times | ||
+ | * 0 = RightHand Direct Controller | ||
+ | * remove Ray interactor | ||
+ | * remove interactor line visual | ||
+ | * remove Line renderer | ||
+ | * [add] "XR Director Interactor" | ||
+ | * hide controller on select = true | ||
+ | * [add] " | ||
+ | * is trigger = true | ||
+ | * radius = 0.1 | ||
+ | * 1 = RightHand Ray Controller (L) | ||
+ | * enable interaction with UI = true | ||
+ | * Raycast config > Raycast mask = UI | ||
+ | * interactor line isual > invalid color gradient all alpha = 0 (???) | ||
+ | * 2 = RightHand Teleport Controller (L) | ||
+ | * active = disabled | ||
+ | * XR controller : selection action = XRI RightHand Locomotion / Teleport select | ||
+ | * Ray interactor : enable interaction with UI = false | ||
+ | * Ray interactor : line type = projectile curve | ||
+ | * Ray interactor : velocity = 8 | ||
+ | * Ray interactor : Raycast mast = Teleport | ||
+ | * interactor line visual : override line length = false | ||
+ | **Blink effect** | ||
+ | * XR origin > Camera offset > Main camera | ||
+ | * clipping planes : near = 0.01 | ||
+ | * [add] as its child, add UI > RAW Image (as BlinkCanvas) | ||
+ | * rename auto created Canvas as " | ||
+ | * BlinkCanvas | ||
+ | * Canvas : render mode = world space, position = [0,0,.02], wh=[0,0] | ||
+ | * [add] script " | ||
+ | * its child: RAWImage: position =[0,0,0], w=2, h=2, color=black | ||
+ | * select BlinkCanvas, | ||
+ | * rawImage: f0: active=true, | ||
+ | * rawImage: f2: alpha=1; event: DoAction | ||
+ | * rawImage: f15: active=false; | ||
+ | * BlinkAnimation (triangle shape icon): loop time = false | ||
+ | * Panel > Animator | ||
+ | * select BlinkCanvas animation controller (box with 2 dot shape icon) | ||
+ | * [add] trigger " | ||
+ | * [add] empty state, and set as default | ||
+ | * [connect] BlinkEmptyState > BlinkAnimation: | ||
+ | * [connect] BlinkAnimation > BlinkEmptyState: | ||
+ | * hide RAWImage by default | ||
+ | **tunneling effect** | ||
+ | * Main camera | ||
+ | * [add] Tunneling mobile | ||
+ | * motion target = XR Origin (??? XR Rig) | ||
+ | * effect coverage = 0.5 | ||
+ | * angular velocity = falsse | ||
+ | * linear velocity = true; max = 1.5 | ||
+ | **Locomotion system** | ||
+ | * [add] XR > LocomotionSystem | ||
+ | * remove Snap Turn Provider (action-based) | ||
+ | * [add] [custom script: SnapTurn folder] Snap Turn Provider Blink Action-based (ActionBasedSnapTurnProviderBlink.cs) | ||
+ | * system = locomotion system | ||
+ | * enable turn around = false (???) | ||
+ | * blink = BlinkCanvas | ||
+ | * Right Hand Snap turn - use reference = true | ||
+ | * reference = XRI RightHand Locomotion/ | ||
+ | * remove Teleportation Provider | ||
+ | * [add] [custom script: Teleportation folder] Teleportation Blink Provider | ||
+ | * system = locomotion system | ||
+ | * blink = BlinkCanvas | ||
+ | * [add] [custom script: Continous ] Continous Move Provider blink (ActionBasedConituousMoveProviderBlink) | ||
+ | * system = locomotion system | ||
+ | * move speed = 2 | ||
+ | * Left hand move action - use reference = true | ||
+ | * reference = XRI LeftHand Locomotion/ | ||
+ | * forward source | ||
+ | * [add][custom] Character controller Driver 2.cs | ||
+ | * locomotion provvider = its Continous move provider (??? doc=locomotion system) | ||
+ | **Rig component** | ||
+ | * XR Origin | ||
+ | * [add] Input Action Manager | ||
+ | * action sets size = 1 | ||
+ | * element0 = XRI Default Input action | ||
+ | * [add] Character controller | ||
+ | * radius = 0.3 | ||
+ | * [add] [custom] ControllerModeSwap.cs | ||
+ | * interactor controller = " | ||
+ | * teleport controller = " | ||
+ | * teleport activation button - use refernece = true | ||
+ | * reference = XRI RightHand Locomotion/ | ||
+ | * BlinkCavans > Blink.cs (uncomment that 2 lines) | ||
+ | * animator = BlinkCanvas | ||
+ | * tunneling = Main Camera | ||
+ | * movement provider = locomotion system (contious move) | ||
+ | **Hand Presenece Prefab** | ||
+ | * [create] empty LeftHand (pos=0,0,0) | ||
+ | * [add] HandPresence.cs | ||
+ | * [add] child: Oculus Hands\Prefabs\Left Hand Model | ||
+ | * pos= 0,0,0; rot = 0,0,120 | ||
+ | * hand material: hands_solid = standard shader | ||
+ | * [option] create transparent hand material: HandMat | ||
+ | * albedo = transparent green, render mode = transparent | ||
+ | * [add][custom: | ||
+ | * hide Right parts | ||
+ | * create controllerMat, | ||
+ | * assign that material to mesh | ||
+ | * ---------- | ||
+ | * LeftHand > HandPresence | ||
+ | * controller = quest2_controllers_div0 | ||
+ | * hand model = Left Hand Model | ||
+ | * grip button - use reference = true | ||
+ | * reference = XRI LeftHand interaction/ | ||
+ | * trigger button - use reference = true | ||
+ | * reference = XRI LeftHand interaction/ | ||
+ | * LeftHand = Prefab; delete from scene | ||
+ | * ----------- | ||
+ | * duplicate LeftHand prefab as RightHand | ||
+ | * remove "Left Hand model" | ||
+ | * [add] Oculus Hands\Prefabs\Right Hand, pos=0,0,0, rot=0, | ||
+ | * assign handMaterial (optional) | ||
+ | * assign controller material | ||
+ | * RightHand > HandPresence | ||
+ | * controller = quest2_controllers_div0 | ||
+ | * hand model = Right Hand Model | ||
+ | * grip reference = XRI RightHand interaction/ | ||
+ | * trigger reference = XRI RightHand interaction / activate | ||
+ | * ------------ | ||
+ | * Back to Scene | ||
+ | * LeftHand Direct Controller > XR controller | ||
+ | * model prefab = LeftHand prefab | ||
+ | * RightHand Direct controller > XR controller | ||
+ | * model prefab = RightHand prefab | ||
+ | **Hand animation** | ||
+ | * select hand prefab, right click | ||
+ | * [create] animation controller for right hand | ||
+ | * [add] parameter float: Grip + Trigger | ||
+ | * create state > from New Blend Tree, double click to edit | ||
+ | * blend type= 2D freeform cartesian | ||
+ | * parameter = grip + trigger | ||
+ | * + x 4 = 4 motion fields, 00, 01,10,11 | ||
+ | * go Oculus Hands / animations | ||
+ | * R_hand_default_anim, | ||
+ | * expand to see the triangle icon, and drag to the Blend Tree | ||
+ | * [duplicate] right hand animation controller as LeftHandAnimationController | ||
+ | * swap the blend tree animation | ||
+ | * ------ | ||
+ | * inside " | ||
+ | * select "Left Hand Model" and "Right Hand Model" | ||
+ | * assign the animation controller accordingly | ||
+ | * ------ | ||
+ | * go Sample >>> | ||
+ | * edit button to open | ||
+ | * XRI RightHand > Actions > + | ||
+ | * Grip (type = value; type=axis; | ||
+ | * binding.path = XR controller \ XR controller (Right Hand) \ optional controls \ grip) | ||
+ | * generic XR controller = true | ||
+ | * XRI RightHand > Actions > + | ||
+ | * Trigger (type = value; type = axis) | ||
+ | * binding.path = XR Controller\XR Controller (Right Hand)\Optional Controls\trigger | ||
+ | * generic XR controller = true | ||
+ | * same Grip + Trigger for XRI Left Hand | ||
+ | * click "save asset button" | ||
+ | * ~~~~~~~ | ||
+ | * RightHand/ | ||
+ | * update reference of Grip and Trigger | ||
+ | **Teleport reticle** | ||
+ | * [drag] [custom Teleport folder] in | ||
+ | * create " | ||
+ | * [Teleport] teleportHightLight : scale factor = 0.01; (apply) | ||
+ | * [add] teleportHightLight to scene, scale = 0.5,1,0.5 | ||
+ | * assign TeleportMaterial | ||
+ | * make it prefab = original prefab; remove from scene | ||
+ | * name as TeleportReticle | ||
+ | **Teleport Anchor** | ||
+ | * create cylinder, scale 1,0.1,1 | ||
+ | * remove collider | ||
+ | * add mesh collider (convex = true) | ||
+ | * [layer] = Teleport | ||
+ | * [add] [teleportation] TeleportationBlinkAnchor.cs | ||
+ | * [add as child] TeleportReticle (scale=0.5, | ||
+ | * teleportationBlinkAncor: | ||
+ | * teleport reticle: active = true | ||
+ | * teleportationBlinkAncor: | ||
+ | * teleport reticle: active = false | ||
+ | * hide teleport reticle | ||
+ | **Teleport Area** | ||
+ | * add floor | ||
+ | * [add] [teleporation] TeleportationBlinkArea.cs | ||
+ | * custom reticle = teleportReticle prefab | ||
+ | * teleport provider = locomotion system | ||
+ | * floor [layer] = Teleport | ||
+ | **Grabbable** | ||
+ | * add cube | ||
+ | * [layer] = " | ||
+ | * add collider | ||
+ | * add rigidbody | ||
+ | * [add] XR Grab Interactable | ||
+ | * or XROffsetGrabInteractable.cs (assign attach transform) | ||
+ | * move type=velocity | ||
+ | **Highlighting for grabable** | ||
+ | * [custom: outlinedDiffuse ]create highlightMaterial (outlined/ | ||
+ | * assign that material to object to highlight | ||
+ | * assign [custom] Highligher.cs to object to highlight | ||
+ | * [drag] itself to both interactor and mesh render | ||
+ | **Socket for grabbable** | ||
+ | * ceate empty game object | ||
+ | * add sphere collider (is trigger = true) | ||
+ | * add "XR Socket interactor" | ||
+ | * [add] new SocketMaterial (transparent, | ||
+ | * to Hover Mesh Material | ||
+ | * (optional) attach point | ||
+ | * (optional) put a vis sphere under it | ||
+ | **other tag socket** | ||
+ | * ??? (wip) | ||
+ | ** UI ** | ||
+ | * [add]XR > UI Canvas (not the UI one) as XRUICanvas | ||
+ | * scale = .002, .002, .002 | ||
+ | * add RAWImage alpha 0 to show ray | ||
+ | * add rest text mesh pro ui | ||
+ | * set canvas and all children [layer] = UI | ||
+ | **BigButton** | ||
+ | * create base | ||
+ | * create top (+rigidbody = is kinematic) | ||
+ | * [add] [custom: things] HandButton.cs | ||
+ | **Leveler** | ||
+ | * [layer] = grab | ||
+ | * add collider | ||
+ | * add rigidbody; gavity = false | ||
+ | * [add] XR Grab interactor | ||
+ | * move type = velocity tracking | ||
+ | * [add] Hinge joint | ||
+ | * use visualizer to set Anchor (if pivot is correct, should be 000) and Axis | ||
+ | * use limit = true | ||
+ | * use spring = true (damper = 1, spring=1) | ||
+ | **Finalize** | ||
+ | * create light > Light Probes Group | ||
+ | * optional blob shadow for character and dynamic objects | ||
+ | * unmoveable object set = static | ||
+ | * Bake lightmaps: window | ||
+ | * build |