<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Aleksey Kuznetsov on Medium]]></title>
        <description><![CDATA[Stories by Aleksey Kuznetsov on Medium]]></description>
        <link>https://medium.com/@alekseykuznetsov?source=rss-1982c3091055------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*_ucn-vEB2eH_pc4V.</url>
            <title>Stories by Aleksey Kuznetsov on Medium</title>
            <link>https://medium.com/@alekseykuznetsov?source=rss-1982c3091055------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 19:57:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alekseykuznetsov/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Creating simple VR application without joystick, but with a comfortable movement (Step-by-step…]]></title>
            <link>https://medium.com/@alekseykuznetsov/creating-simple-vr-application-without-joystick-but-with-a-comfortable-movement-step-by-step-b97711d1d8d9?source=rss-1982c3091055------2</link>
            <guid isPermaLink="false">https://medium.com/p/b97711d1d8d9</guid>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[virtual-reality]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[tutorial]]></category>
            <dc:creator><![CDATA[Aleksey Kuznetsov]]></dc:creator>
            <pubDate>Mon, 24 Apr 2017 12:40:27 GMT</pubDate>
            <atom:updated>2017-04-24T12:47:18.900Z</atom:updated>
            <content:encoded><![CDATA[<h3>Creating simple VR application without joystick, but with a comfortable movement (Step-by-step Tutorial)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RUysXgp447CVGHMNbr_cLw.jpeg" /></figure><p>Hello!</p><p>I want to tell you about a convenient system of non-stick control in the mobile virtual reality — <a href="https://www.assetstore.unity3d.com/en/#!/content/83642">GVRNavi</a>. It usually takes from 20 to 60 seconds for user to understand how to move in this system.</p><p>See it in action.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FfQemXJUsQmQ%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DfQemXJUsQmQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FfQemXJUsQmQ%2Fhqdefault.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/d7028c456334bdbcb08a8b127d6b8f25/href">https://medium.com/media/d7028c456334bdbcb08a8b127d6b8f25/href</a></iframe><h3>Introduction</h3><p>Games and applications of the virtual reality have recently enjoyed great popularity. Everything is clear with such as HTC Vive, Oculus Rift, PS VR and others, though there is a problem with virtual reality on mobile devices. As far as you know, there are various virtual reality glasses performed right for mobile devices by different producers, starting with Google Cardboard and VR BOX, and up to Google Daydream and Samsung Gear VR, which are much more expensive.</p><p>Not all of them have control, included in the supply — joystick.</p><p>So let’s have a precise look at the problem. What ways to control the movements in mobile virtual reality do you know? Probably, I have forgotten something, so you can easily comment on it as far as it would be interesting for thousands of people.</p><p>Movements in Virtual reality:</p><ul><li>point movement;</li><li>I go the way I see. «I go non-stop»;</li><li>joystick is underarm, atop, anyway it can be for it not to block the screen;</li><li>unshifting navigation.</li></ul><p>These ways have the following basic problems:</p><ul><li><strong>Point movement — </strong>there is no opportunity to go in any direction, there is no freedom of movements. It’s good for virtual museums and for the projects that are alike.</li><li><strong>I go the way I see — </strong>there is a freedom of motions, but there is no opportunity to look closer at anything. You are constantly crashing into walls. It’s good for the runners.</li><li><strong>Joystick is underarm — </strong>there is a freedom of motions, but if you switch it too often, you have to incline your head deep down and as a result your neck can possibly start aching. Though, this way is rather popular at the moment.</li><li><strong>GVRNavi — </strong>there is a freedom of motions and no problems with the head inclined. Talking about disadvantages, it should be admitted that it can block the content from time to time. This problem can be solved with the help of the settings in the assembly.</li></ul><h3>Preparation</h3><p>Install Unity Daydream technical preview. You should make sure that component “Android Build Support” for Android or “iOS Build Support” for iOS is switched on during the installation. For assembling VR application to iOS simple Unity3d version 5.2.1 and over can be used.</p><p>Create a new project.</p><p>Choose the right platform for the project: File -&gt; Build Settings -&gt; Choose Android or iOS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*nzrDyCPjyi3pGwXVzX-log.png" /></figure><p>Then close the window.</p><p>Then go to File -&gt; Build Settings -&gt; Player Settings. Tick Virtual Reality Supported and choose Cardboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/358/1*jErOjpeFibl1RejxLuEykA.png" /></figure><p>Download and import Google VR SDK for Unity (version 1.30 at the moment of the article written).</p><p>Download and import GVRNavi.</p><h3>Tuning Google VR SDK</h3><p>To begin with add standard prefabs from Google VR SDK to the scene, which will provide camera control in space and event system operation:</p><ul><li>Assets/GoogleVR/Prefabs/GvrViewerMain.prefab — contains script GvrViewer, which tracks the head position of a user and provides a scene for a device to apply distortion.</li><li>Assets/GoogleVR/Prefabs/GvrControllermain.prefab</li><li>Assets/GoogleVR/Prefabs/UI/GvrEventSystem.prefab — provides the work of the event system and interface for input system with a sight.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/569/1*T9M3Cx0kkM6vatYGrKKiMw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*i45r4GVH9zlTKJOb_NkoTA.png" /></figure><p>Note that you should indicate Minimum API Level = 19 or lower while creating a build for Android in File -&gt; Build Settings -&gt; Player Settings, otherwise the error occurs at the compilation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/358/1*SCg-Y5qFGPS0j_TRldqmyg.png" /></figure><h3>Checking Virtual Reality</h3><p>Now you can check the work of Google VR. To do it, we should place a standard cube on the scene remove it from the camera a bit and start the scene. When the key Alt is pressed, you can rotate the camera with the mouse in the editor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lLcY4p4kOvy_jx7aqSpfOg.png" /></figure><p>You can check the work of your plug-in right on the device. If you start the scene in the editor, and the distortion of the final image is not applied (the division for both the eyes does not work), a check-box “VR Mode Enabled” should be activated then in the GVRViewer component.</p><p>Let’s make up a simple scene from the standard cubes before setting GVRNavi.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YKHAq8FTg8ES8oe2yIA4UA.png" /></figure><h3>Basic Setting of the GVRNavi</h3><p>Prefab Assets/GVRNavi/Prefabs/VRPlayer.prefab must be added to the scene now.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/791/1*zOz3rmAlquTpYp09EZBTvw.png" /></figure><p>Prefab is a simple controller, which lets the camera move horizontally. It contains camera in subsidiary objects. So, while adding prefab to the scene, one should delete the camera, which was added automatically during the new scene creation.</p><p>Not let’s add a three-dimensional ring to the scene. When aiming at it, we will activate movements. To do it, let us add prefab Assets/GVRNavi/Prefabs/VRRingSimple.prefab to the scene and then make it a subsidiary object “3D_UI”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/307/1*BZCy4Uvi3RVBdSuneys1QQ.png" /></figure><p>Then let’s indicate the necessary reactions to the events in the component VR Ring Simple, as it is shown in the screenshot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*LOuw8dyKtKFvF4QC-4Om0A.png" /></figure><p>The “On Ring Enter” event is triggered when the sight hits the ring zone. The “On Ring Exit” event is triggered when the sight comes out of the ring area. The “On Ring Trigger” event is triggered after the sight enters the ring zone and a certain time passes during which the sight remains on the ring (the time is set by changing the value of “TimeToTrigger” in the “VR Ring Simple” component). The reactions we have set for the events will enable the camera’s motion mode to be switched on / off, as well as to change the sight texture.</p><p>The “Transform” of the character’s camera should be appointed in the “Floor Panel Rotation” component. In case it is not done, the ring will not rotate when the camera is turned and the sight will not get in the collider of the ring (collider is situated only in the front part of the ring).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/353/1*Bk1yCt-p2U7Db39wbPBjYQ.png" /></figure><h3>Checking GVRNavi</h3><p>Now start the scene and aim the sight at the ring. If the sight hits the ring zone, it will expand, and the trigger will work in a second, so you will start moving forward.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gldABjmlpQJFC_p6x_TP-g.png" /></figure><p>You can rotate the camera, changing the direction of movement within the ring. As soon as the sight leaves the ring zone, an event will be generated and the camera will stop.</p><h3>Adding interactivity to the scene</h3><p>Let’s create a new object which can be run. We should create a standard cube in the scene. We create a new material, which we point out in a different from the white colour, and assign it to the cube.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hB8_v-mbbj9hC0VAeD-hqQ.png" /></figure><p>Let’s create a file VRCube.cs and insert the following key there:</p><pre>using UnityEngine;</pre><pre>using GVRNavi;</pre><pre>[RequireComponent(typeof(MeshRenderer))]</pre><pre>public class VRCube : VRObjectGaze</pre><pre>{</pre><pre>  #region variables</pre><pre>  public Vector2 rangeX, rangeY, rangeZ;</pre><pre>  public Color hoveredColor = Color.green;</pre><pre>  private Vector3 _defaultPosition;</pre><pre>  private Color _defaultColor;</pre><pre>  private MeshRenderer _mesh;</pre><pre>  #endregion<br></pre><pre>  protected override void Start()</pre><pre>  {</pre><pre>    base.Start();</pre><pre>    _defaultPosition = transform.position;</pre><pre>    _mesh = GetComponent&lt;MeshRenderer&gt;();</pre><pre>    _defaultColor = _mesh.material.color;</pre><pre>  }<br></pre><pre>  public override void OnGazeEnter()</pre><pre>  {</pre><pre>    base.OnGazeEnter();</pre><pre>    if (_mesh != null)</pre><pre>      _mesh.material.color = hoveredColor;</pre><pre>  }<br></pre><pre>  public override void OnGazeExit()</pre><pre>  {</pre><pre>    base.OnGazeExit();</pre><pre>    if (_mesh != null)</pre><pre>      _mesh.material.color = _defaultColor;</pre><pre>  }<br></pre><pre>  public void SetToDefaultPosition()</pre><pre>  {</pre><pre>    transform.position = _defaultPosition;</pre><pre>  }<br></pre><pre>  public void SetToRandomPosition()</pre><pre>  {</pre><pre>    transform.localPosition = new Vector3(</pre><pre>    Random.Range(rangeX.x, rangeX.y),</pre><pre>    Random.Range(rangeY.x, rangeY.y),</pre><pre>    Random.Range(rangeZ.x, rangeZ.y));</pre><pre>  }</pre><pre>}</pre><p>Let’s appoint the script VRCube for the cube. This will allow us to interact with the cube with the help of the sight. When the trigger is activated, the cube will move to a random point in space within the specified range. To interact with the sight, the object should implement the interface “IGvrGazeResponder”, which is made by the script “VRObjectGaze”, from which “VRCube” is inherited.</p><p>The vector parameters “rangeX”, “rangeY”, “rangeZ” indicate the range of values ​​for the corresponding axes in which the cube can be positioned when the position is changed. Parameter “hoveredColor” is the colour that will be assigned to the material of the cube when aiming the sight at the cube.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/352/1*B61ODYre6g01AM6G0dhtGA.png" /></figure><p>Colour changing functional is contained in the script’s methods, so you needn’t appoint reactions for the events. To change the position of the cube in space, the reaction for the trigger’s work event must be set — the process SetToRandomPosition() function, which is situated in the same script VRCube.</p><p>Now when you start the scene, you can hover over the cube and check the colour change and the cube’s position change when the trigger is at work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uWJaBumnG5lwJKsmhtpR4w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6z3NcZhk90Z1dVjRnHu2dg.png" /></figure><p>Let us introduce one more possibility — the return of the cube in its original position. To do this, add the prefab Assets/GVRNavi/Prefabs/ VRRingContainer.prefab to the scene. This is a ring of the second type from the plug-in GVRNavi. It allows you to attach other elements to the ring: buttons, checkboxes, scrollbars, etc. This ring, as well as the first one, must be a subsidiary object of 3D_UI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/305/1*AetvXCcTu3h3jDaVr36c6g.png" /></figure><p>You shouldn’t forget to tick “Transform” of the camera in the “Floor Panel Rotation” script, as we did for the first ring. It is also necessary to move the ring downwards so that it is situated below the first ring.</p><p>Now let’s start the scene. When you aim the sight at the first ring, the second ring appears below it.</p><p>Now it is not beneficial at all, so stop the scene and add something useful to it.</p><p>The ring has a subsidiary object “Root”. It serves as a container for other VR objects that will be attached to the ring. Add to the object “Root” the prefab of the VR-button Assets/GVRNavi/Prefabs/VRButton.prefab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/306/1*cyr73MZV_uDLOp3y4HqkUg.png" /></figure><p>The position of the button on the ring is controlled by changing the “Rotation” vector in the “Transform” component, and not by the changing of the “Position” vector. You should add a response to the triggering event in the script of the “VRButtonGaze” button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/366/1*SIyIhMinzD4K8ZOOnF6hIA.png" /></figure><p>When the button is clicked, the cube position will be reset to its original one.</p><p>That’s all!</p><p>Thank You for Your attention! You can always contact the developers by e-mail: <a href="/service/mailto:support@garpix.com">support@garpix.com</a>.</p><p>Also, if you need any additional functionality or help with working with the plugin, you can contact us by this e-mail. We always try to help wherever possible.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b97711d1d8d9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>