diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index b6b01395..c070700e 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -589,6 +589,14 @@ MonoBehaviour: onDisable: m_PersistentCalls: m_Calls: [] + destroyOnRemote: 1 + changeLayerOnRemote: 0 + changeLayerOnRemote_IncludeChildren: 0 + remoteLayer: 0 + onRemoteStart: + m_PersistentCalls: + m_Calls: [] + networkObject: {fileID: 0} provider: {fileID: 1094482252} headTransform: {fileID: 1319250515} neckTransform: {fileID: 915169259} @@ -2582,6 +2590,14 @@ MonoBehaviour: onDisable: m_PersistentCalls: m_Calls: [] + destroyOnRemote: 1 + changeLayerOnRemote: 0 + changeLayerOnRemote_IncludeChildren: 0 + remoteLayer: 0 + onRemoteStart: + m_PersistentCalls: + m_Calls: [] + networkObject: {fileID: 0} leftHandFilter: {fileID: 11400000, guid: 50ec9aaea25c7e4488933ba25841d9c1, type: 2} rightHandFilter: {fileID: 11400000, guid: 5e7852ab528cf7049a2564ce67ec972b, type: 2} body_inertia: 0.3 @@ -3691,6 +3707,14 @@ MonoBehaviour: onDisable: m_PersistentCalls: m_Calls: [] + destroyOnRemote: 1 + changeLayerOnRemote: 0 + changeLayerOnRemote_IncludeChildren: 0 + remoteLayer: 0 + onRemoteStart: + m_PersistentCalls: + m_Calls: [] + networkObject: {fileID: 0} provider: {fileID: 1094482252} headTransform: {fileID: 669086425} neckTransform: {fileID: 1031570146} @@ -5328,6 +5352,14 @@ MonoBehaviour: onDisable: m_PersistentCalls: m_Calls: [] + destroyOnRemote: 1 + changeLayerOnRemote: 0 + changeLayerOnRemote_IncludeChildren: 0 + remoteLayer: 0 + onRemoteStart: + m_PersistentCalls: + m_Calls: [] + networkObject: {fileID: 0} provider: {fileID: 1094482252} headTransform: {fileID: 3044430112826797404} neckTransform: {fileID: 5438031033841814548} diff --git a/Packages/com.avr.core/Documentation/docs/html/md_tutorials_quickstart_tutorial_1.html b/Packages/com.avr.core/Documentation/docs/html/md_tutorials_quickstart_tutorial_1.html index c25aef85..131e0507 100644 --- a/Packages/com.avr.core/Documentation/docs/html/md_tutorials_quickstart_tutorial_1.html +++ b/Packages/com.avr.core/Documentation/docs/html/md_tutorials_quickstart_tutorial_1.html @@ -148,7 +148,7 @@
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 AVR > Open DevConsole
.
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, toggle Plane
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 DevConsole documentation page.
Continue in tutorial 2
+Continue in tutorial 2.
diff --git a/Packages/com.avr.core/Documentation/docs/html/md_tutorials_quickstart_tutorial_2.html b/Packages/com.avr.core/Documentation/docs/html/md_tutorials_quickstart_tutorial_2.html index a73b2671..95a49a95 100644 --- a/Packages/com.avr.core/Documentation/docs/html/md_tutorials_quickstart_tutorial_2.html +++ b/Packages/com.avr.core/Documentation/docs/html/md_tutorials_quickstart_tutorial_2.html @@ -88,21 +88,41 @@TODO
-create playerrig
Next up, we'll want to create a VR PlayerRig that represents the player (HMD + controllers) in our virtual space.
+Creating a PlayeRig with arc-vr is easy. Simply click on AVR > Create Player Rig
in the top menu bar. Alternatively, you can navigate to Packages/arc-vr-core/Editor/DefaultPrefabs
and drag-&-drop a PlayerRig object into your scene.
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.
+If you now click on 'Play', you should be able to view your scene through your VR headset.
+Project Settings > XR Plugin Management
, or the scene won't launch in VR mode.TODO
-add controllers to playerrig
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.
+Adding left/right controllers to our PlayerRig is simple.
+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).
+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.
+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.
+If you launch the scene now, you should be able to see both controllers through your headset.
+Continue in tutorial 3.
diff --git a/Packages/com.avr.core/Documentation/docs/html/md_tutorials_quickstart_tutorial_3.html b/Packages/com.avr.core/Documentation/docs/html/md_tutorials_quickstart_tutorial_3.html index 7e6c79de..feb0213a 100644 --- a/Packages/com.avr.core/Documentation/docs/html/md_tutorials_quickstart_tutorial_3.html +++ b/Packages/com.avr.core/Documentation/docs/html/md_tutorials_quickstart_tutorial_3.html @@ -88,37 +88,37 @@import phys and motion
LEFT: Add modules
RIGHT: Add modules:
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.
+We're going to import two additional packages for this: arc-vr-motion and arc-vr-phys.
+Just as with arc-vr-core, download the packages from github and install them with the package manager.
+Theoretically, we could simply position the VR Rig in front of the table, which would make moving around unnecessary.
+However, to keep things simple and for demonstration purposes, we'll let the player move around the scene.
+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.
+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 MovementProvider and TurnProvider docs.
+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.
+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.
+If you take a quick look at the newly created 'BGrabProvider' object, you'll see it comes with two children:
+import arc-vr-props
show off sphere grabbin stuff
+Our player is now able to grab and interact with objects, but we haven't given them any objects to interact with yet.
+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 here for download. (For the table you can just use a re-scaled cube if necessary).
+Now we've got an urn we next need to fill it with colored balls.
+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.
+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).
+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.
+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.
+Now you'll only have to duplicate both spheres multiple times and place them above the urn.
+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.
+TODO: video
diff --git a/Packages/com.avr.core/Documentation/docs/html/md_tutorials_quickstart_tutorial_4.html b/Packages/com.avr.core/Documentation/docs/html/md_tutorials_quickstart_tutorial_4.html index f3caf262..d3365fe2 100644 --- a/Packages/com.avr.core/Documentation/docs/html/md_tutorials_quickstart_tutorial_4.html +++ b/Packages/com.avr.core/Documentation/docs/html/md_tutorials_quickstart_tutorial_4.html @@ -88,41 +88,61 @@import arc-vr-ui
-add UIInteractionProvider to left controller
use console to find window
We want the player to guess which color they'll draw before reaching into the urn. We'll do this by presenting the player with an in-game UI window, for which we'll need the arc-vr-ui package.
+The installation procedure shoule be familiar by now: download the .tgz from github, import it via the package manager.
+The subsequent steps should be familiar as well: select the controller you want to act as a UI pointer, click 'Add Module' and select 'UIInteractionProvider'.
+If you now select the UIInteractionProvider, you might notice the warning it displays. As with any Unity-related UI system, an 'EventSystem' is required. If you click the 'Fix now' button, a new EventSystem object will be created (together with an attatched VRInput component).
+The selected controller is now fully functional as a UI pointer, which will work with any world-space unity canvas.
+The arc-vr-ui package comes with several pre-fabricated UI elements, which we'll make use of in the next steps. There are seveal options to find what we're looking for:
+Packages > arc-vr-ui > Runtime > Prefabs
and find 'GenericWindow_Borderless'.prefabs ui window
in the developers console. This will set your project explorer search to look for the word 'window' inside the arc-vr-ui package. Find the GenericWindow_Borderless prefab.Once you've found it, drag the 'GenericWindow_Borderless' into scene and place it in front of the table.
+Next up we'll need some buttons. Use any of the methods above to search for button. You should find a simple 'Button_large' prefab. Drag three of them onto the GenericWindow, place them one above the other and change their text to "Guess Blue", "Guess Red" and "Start" respectively.
+We now have all the elements of our scene ready. The buttons won't actually do anything as of right now, but they'll be clickable with a controller.
DIRECTOR
-Create new Script "UrnExperiment"
For this next step we'll be using the TrialExperiment class to create a trial-based structure to our experiment. A 'trial' will follow the following procedure:
+Add following code: ``` public GameObject urn; public GameObject guess_ui;
-public override IEnumerator trial() { urn.SetActive(false); guess_ui.SetActive(true);
-yield return new WaitUntil(can_proceed);
-urn.SetActive(true); guess_ui.SetActive(false);
-yield return new WaitForSeconds(5); } ```
-Put this into scene
+The implementation is simple. Create a new script (call it something like UrnExperiment
) and make it inherit from AVR.Core.AVR_TrialExperiment. The TrialExperiment class is a simple one that models trials as Coroutines. We'll simply override the trial()
function with the above listed procedure. Add this code inside your class:
public GameObject urn; +public GameObject guess_ui; + +public override IEnumerator trial() { + // Disable urn, enable UI + urn.SetActive(false); + guess_ui.SetActive(true); + + // Wait for next step + yield return new WaitUntil(can_proceed); + + // Enable urn, disable UI + urn.SetActive(true); + guess_ui.SetActive(false); + + // Wait a couple of seconds + yield return new WaitForSeconds(5); +} +
Now attach this script to some fitting gameobject.
Put urn and balls under one object
-Put Green and Blue buttons under one object
-Assign both to the UrnExperiment script
-Assign button actions:
As a last step, we'll just have to connect all the dots.
+If you haven't already, parent the urn and all the balls under a single gameobject, so we can easily toggle them on and off.
+Then select your 'UrnExperiment' script we created in the previous step and assign the 'urn' property to be the parent object of the urn and balls. Assign the 'guess_ui' property to the GenericWindow that includes the three buttons.
+Select each of the buttons, and add an 'OnClick' event. For the 'Guess Blue' / 'Guess Red' buttons set the OnClick event to be UrnExperiment.proceed()
. For the 'Start' button, set it to UrnExperiment.commence
, with the amount of trials as the argument (eg. 10).
If you now click play, the project should be complete. Once you click the 'Start' button, the urn will be hidden. It will then only show once you've guessed a color. You will then have 5 seconds to draw a sphere before the process begins again.
Add AVR_Logger with 2 columns
If we wish to record and collect data on the experiment, we can use the provided AVR_Logger class.
+Simply select any gameobject (for instance the same one that has the 'UrnExperiment' script) and add an AVR_Logger component to it.
+We're going to keep things simple, and create a basic csv-table with two columns: time and the corresponding object the player is grabbing.
+Add a new entry to the 'Columns' property, set the label to 'time' and select the type as 'TIME'. Add a second entry, set the label to something like 'object' and leave the type as 'CUSTOM'.
+The AVR_Logger uses C# reflection to extract properties from certain objects, including private or protected ones. Any value exposed in a property is thus simple to log with this. In our case, we want to know what the player is holding on to, so it seems logical to look for an appropriate field in our BasicGrabProvider script. If you look at the docs for BasicGrabProvider you'll see it has a protected field called 'grabbedObject', which corresponds to the AVR_Grabbable the player is holding.
+To log this field, simply drag and drop the BasicGrabProvider into the 'Target' field of the newly created column and set 'Field' to be grabbedObject
. Leave read type as 'AUTO'.
If you now launch the scene again, there'll be a logs/sample.log
file which includes a timestamp as well as the name of the object the player is holding at that time.