Skip to content

Commit

Permalink
Knock, knock. Who's there? - Another 5 pages of documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Helliaca committed Aug 18, 2021
1 parent 07a77ef commit f266abd
Show file tree
Hide file tree
Showing 16 changed files with 494 additions and 253 deletions.
32 changes: 32 additions & 0 deletions Assets/Scenes/SampleScene.unity

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ <h1>Step 3: Getting Familiar</h1>
</div>
<p>It should list the arc-vr packages you have installed (only arc-vr-core) and present you with 4 buttons. Click the 4th (the right-most one) to open an 'ARC-VR Console' window. Alternatively, you can also just click on <code><a class="el" href="namespace_a_v_r.html">AVR</a> &gt; Open DevConsole</code>.</p>
<p>This developer's console is a useful tool which is fully available inside the Unity Editor but also during runtime. It can also allow you to make some on-the-fly changes during runtime, should you have to. Type, for instance, <code>toggle Plane</code> and press Enter. If you have an object called 'Plane' in your scene it should be toggled from active, to inactive. If you want to add commands of your own or get more familiar with this useful tool, take a look at the <a href="https://www.TODO.com">DevConsole documentation page</a>.</p>
<p>Continue in <a class="el" href="md_tutorials_quickstart_tutorial_2.html">tutorial 2</a> </p>
<p>Continue in <a class="el" href="md_tutorials_quickstart_tutorial_2.html">tutorial 2</a>. </p>
</div></div><!-- contents -->
<!-- start footer part -->
<script src="custom.js"></script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,21 +88,41 @@
<img src="../../res/images/avr_logo_bw_wide.png" alt="Logo"/>
</div>
<h1>Step 4: Base VR Rig</h1>
<p>TODO</p>
<p>create playerrig</p><ul>
<li>delete MainCamera</li>
<li>got to menuitem <a class="el" href="namespace_a_v_r.html">AVR</a>&gt;Create PlayerRig</li>
<li>start and show yay we can see things in vr</li>
</ul>
<p>Next up, we'll want to create a VR PlayerRig that represents the player (HMD + controllers) in our virtual space.</p>
<p>Creating a PlayeRig with arc-vr is easy. Simply click on <code><a class="el" href="namespace_a_v_r.html">AVR</a> &gt; Create Player Rig</code> in the top menu bar. Alternatively, you can navigate to <code>Packages/arc-vr-core/Editor/DefaultPrefabs</code> and drag-&amp;-drop a PlayerRig object into your scene.</p>
<p>The PlayerRig includes a Camera object tagged as MainCamera. In order to not get Unity confused, its best to only have one single Camera object tagged as the main camera. Thus, delete the default "MainCamera" GameObject from your scene.</p>
<p>If you now click on 'Play', you should be able to view your scene through your VR headset.</p>
<dl class="section note"><dt>Note</dt><dd>Make sure 'Initialize XR on Startup' is enabled, under <code>Project Settings &gt; XR Plugin Management</code>, or the scene won't launch in VR mode.</dd></dl>
<h1>Step 5: VR Controllers</h1>
<p>TODO</p>
<p>add controllers to playerrig</p><ul>
<li>ignore docu button for now</li>
<li>add controllers to playerrig</li>
<li>show that two controllers have been added</li>
<li>show that in terms of modules, we can ONLY add InputManager</li>
<li>Show DOCU button </li>
<p>We are now able to view our scene through our tracked HMD. As a next step, we ought to include the Vive controllers, representing the left and right hands of the player.</p>
<h2>Adding the controllers</h2>
<p>Adding left/right controllers to our PlayerRig is simple.</p>
<ul>
<li>Select the 'PlayerRig' gameobject.</li>
<li>In the inspector, click on the 'Add Module' button.</li>
<li>In the opened dialogue window, tick 'Left Controller' and 'Right Controller'.</li>
<li>Click on 'Update'.</li>
</ul>
<p>Your PlayerRig gameobject should now have three child objects: 'Camera Offset' (represents the HMD), as well as 'LeftHandController' and 'RightHandController' (represent the left/right controllers).</p>
<dl class="section note"><dt>Note</dt><dd>This workflow pattern is common in arc-vr. An object will have a selection-wizard for a set of modules, and those modules will be added as child-objects. You can insert your own modules into these dialogue-windows. For more info, check the docs on <a class="el" href="class_a_v_r_1_1_u_editor_1_1_core_1_1_a_v_r___hookable_wizard_3_01_t_01_4.html">AVR_HookableWizard</a> and <a class="el" href="class_a_v_r_1_1_u_editor_1_1_core_1_1_a_v_r___wizard_hook_3_01_wiz_01_4.html">AVR_WizardHook&lt;Wiz&gt;</a>.</dd></dl>
<h2>Adding a controller visual and inputmanager</h2>
<p>We now have two gameobjects that represent the tracked VR controllers. However, we can't see them in our virtual space, as they simply are empty transforms.</p>
<p>To add a rendered mesh to make our controller visible, individually select each controller gameobject and click on 'Add Module', tick 'ControllerVisual' and 'InputManager', then click Update.</p>
<p>If you launch the scene now, you should be able to see both controllers through your headset.</p>
<dl class="section note"><dt>Note</dt><dd>The "InputManager" module is <em>not</em> required to make the controller visible. You only need an InputManager if you are planning to use inputs (ie the buttons on the controller). We'll be using these in future steps, so may as well add them now.</dd></dl>
<p></p>
<dl class="section note"><dt>Note</dt><dd>More selectable modules will appear in these dialogue windows once you import more arc-vr packages.</dd></dl>
<p></p>
<dl class="section note"><dt>Note</dt><dd>Each <a class="el" href="class_a_v_r_1_1_core_1_1_a_v_r___component.html">AVR_Component</a> script displays 2-3 buttons within the editor: <div class="image">
<img src="../../res/images/core_editorButtons.jpg" alt="img"/>
</div>
<ul>
<li><em>Documentation Link</em>: Will open up the respective documentation page in your browser.</li>
<li><em>Custom Monobehaviour Events</em>: Will let you set UnityEvents that are executed when the Monobehaviour Awake, Start, OnEnable or OnDisable are called. You can use this, for instance, to maintain two modules mutually exclusive. For example, you might not want to let the player teleport/move whilst interacting with UI. Then you would simple add an OnEnable event onto your UIInteractionProvider that disables the MovementProvider, and vice-versa for OnDisable.</li>
<li><em>Network Behaviour</em>: This button is only present if the <a class="el" href="md_tutorials_arc-vr-net.html#arc-vr-net">arc-vr-net</a> package is included in the project. It gives you some useful tools for how components ought to behave when on a network.</li>
</ul>
</dd></dl>
<p>Continue in <a class="el" href="md_tutorials_quickstart_tutorial_3.html">tutorial 3</a>. </p>
</div></div><!-- contents -->
<!-- start footer part -->
<script src="custom.js"></script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,37 +88,37 @@
<img src="../../res/images/avr_logo_bw_wide.png" alt="Logo"/>
</div>
<h1>Step 6: Importing additional packages</h1>
<p>import phys and motion</p><ul>
<li>show that console has picked that up</li>
</ul>
<h1>Step 7: Adding Movement</h1>
<p>LEFT: Add modules</p><ul>
<li>InputManager</li>
<li>MovementProvider</li>
<li>HandVisual (Controller)</li>
</ul>
<p>RIGHT: Add modules:</p><ul>
<li>InputManager</li>
<li>GrabProvider (BASIC)</li>
<li>HandVisual (Controller)</li>
<p>We now have a rudimentary VR rig with HMD and both controllers. As a next step we'll allow the player to pick up and interact with physical objects.</p>
<p>We're going to import two additional packages for this: <a class="el" href="md_tutorials_arc-vr-motion.html#arc-vr-motion">arc-vr-motion</a> and <a class="el" href="md_tutorials_arc-vr-phys.html#arc-vr-phys">arc-vr-phys</a>.</p>
<p>Just as with arc-vr-core, download the packages from github and install them with the package manager.</p>
<h1>Step 7: Adding Modules</h1>
<h2>Letting the player move around</h2>
<p>Theoretically, we could simply position the VR Rig in front of the table, which would make moving around unnecessary.</p>
<p>However, to keep things simple and for demonstration purposes, we'll let the player move around the scene.</p>
<p>Select the controller you want to handle movement, I'd suggest the left hand controller. Click on 'Add Module' and select 'MovementProvider' as well as 'TurnProvider'. These two modules essentially 'provide' movement and turning functionality to the controller they are attatched to.</p>
<p>You can take a gander at the newly created child-objects and play around with the settings. If you're looking for more details on these modules, look at the <a class="el" href="class_a_v_r_1_1_motion_1_1_a_v_r___movement_provider.html">MovementProvider</a> and <a class="el" href="class_a_v_r_1_1_motion_1_1_a_v_r___turn_provider.html">TurnProvider</a> docs.</p>
<h2>Letting the player interact with objects</h2>
<p>The goal is to let the player draw colored spheres from an urn. For this we want to allow the player to grab/interact with rigidbody objects.</p>
<p>Just as with the step before, select the controller that will handle physics interactions (I'd suggest the right-handed one) and add a 'GrabProvider' module. There are several types of grab providers. For this project the 'Basic' type will suffice.</p>
<p>If you take a quick look at the newly created 'BGrabProvider' object, you'll see it comes with two children:</p>
<ul>
<li>A 'GrabZone', that defines a volume from which the GrabProvider will select the nearest object when a grab is provided.</li>
<li>As well as a 'GrabSpot'. A grabbed object's center will be pulled towards this GrabSpot. If you want to grab an object at another location than its center (example: grabbing a stick by either end) you'll need to employ <a class="el" href="class_a_v_r_1_1_phys_1_1_a_v_r___offset_grab_provider.html">a different type of grabprovider</a>.</li>
</ul>
<h1>Step 8: Creating the Scene</h1>
<p>import arc-vr-props</p><ul>
<li>find table model and place it</li>
<li>find urn model and place it</li>
<li>find 2 spheres an place them</li>
<li>add rigidbody<ul>
<li>0.1 mass</li>
<li>Coll: Continuous Speculative</li>
</ul>
</li>
<li>add Grabbable<ul>
<li>VeryLightProp</li>
</ul>
</li>
<li>Duplicate them a whole lot</li>
</ul>
<p>show off sphere grabbin stuff </p>
<p>Our player is now able to grab and interact with objects, but we haven't given them any objects to interact with yet.</p>
<p>As a next step we'll expand our scene to include a table with an urn on top of it. You can find the 3d model of the urn <a href="www.TODO.com">here</a> for download. (For the table you can just use a re-scaled cube if necessary).</p>
<h2>Filling the urn</h2>
<p>Now we've got an urn we next need to fill it with colored balls.</p>
<p>Create a 3d sphere and resize it to an adequate size (I've used 0.1 for all three axes). Place it so that it hovers above the urn's cavity.</p>
<p>To turn the sphere into a phyiscs object, add a rigidbody component to it. Set collision detection to 'continuous speculative'*. Additionally, whilst not actually necessary, it's generally good practice to use realistic mass values for rigidbodies, so set its' mass to about 0.1 (100g).</p>
<dl class="section note"><dt>Note</dt><dd>* Any type collision detection will do, but in this particular case the balls tend to leak through the urn's walls on different collision detection methods.</dd></dl>
<p>Finally, we'll have to turn the rigidbody into a grabbable object. Simply select the gameobject that has the rigidbody attatched and add an 'AVR_Grabbable' component. You don't need to bother with any of its' properties except for 'Object Type'. If you try to set 'Object Type, you'll find that there are several pre-configured scriptable objects available, which determine how the object behaves when grabbed. For a small sphere, 'VeryLightProp' works the best. If you don't set this field, the AVR_Grabbable will default to a preset type.</p>
<p>Only step left is to give the sphere an adequate color. Create two new materials, one red the other blue and apply one of them to the sphere. Duplicate the sphere and apply the other material to that.</p>
<p>Now you'll only have to duplicate both spheres multiple times and place them above the urn.</p>
<h2>Test it out</h2>
<p>If you now launch your scene, you should be able to move up to the table using the left controller, then grab a sphere out of the urn using the right controller.</p>
<p>TODO: video </p>
</div></div><!-- contents -->
<!-- start footer part -->
<script src="custom.js"></script>
Expand Down
Loading

0 comments on commit f266abd

Please # to comment.