Browse Source

Merge pull request #1278 from skyace65/CSharp_VR

Add C# to ARVR page
Max Hilbrunner 7 years ago
parent
commit
fc0442aaf7
1 changed files with 10 additions and 1 deletions
  1. 10 1
      tutorials/vr/vr_primer.rst

+ 10 - 1
tutorials/vr/vr_primer.rst

@@ -17,12 +17,21 @@ You can use the function :ref:`get_interfaces <class_ARVRServer_get_interfaces>`
 
 
 To enable an interface you execute the following code:
 To enable an interface you execute the following code:
 
 
-::
+.. tabs::
+ .. code-tab:: gdscript GDScript 
 
 
     var arvr_interface = ARVRServer.find_interface("Native mobile")
     var arvr_interface = ARVRServer.find_interface("Native mobile")
     if arvr_interface and arvr_interface.initialize():
     if arvr_interface and arvr_interface.initialize():
         get_viewport().arvr = true
         get_viewport().arvr = true
 
 
+ .. code-tab:: csharp
+
+    var arvrInterface = ARVRServer.FindInterface("Native mobile");
+    if (arvrInterface != null && arvrInterface.Initialize())
+    {
+        GetViewport().Arvr = true;
+    }
+
 This code finds the interface we wish to use, initializes it and if that is successful binds the main viewport to the interface. This last step gives some control over the viewport to the interface which automatically enables things like stereo scopic rendering on the viewport.
 This code finds the interface we wish to use, initializes it and if that is successful binds the main viewport to the interface. This last step gives some control over the viewport to the interface which automatically enables things like stereo scopic rendering on the viewport.
 
 
 For our mobile vr interface, and any interface where the main input is directly displayed on screen, the main viewport needs to be the viewport where arvr is set to true. But for interfaces that render on an externally attached device you can use a secondary viewport. In this later case a viewport that shows its output on screen will show an undistorted version of the left eye while showing the fully processed stereo scopic output on the device.
 For our mobile vr interface, and any interface where the main input is directly displayed on screen, the main viewport needs to be the viewport where arvr is set to true. But for interfaces that render on an externally attached device you can use a secondary viewport. In this later case a viewport that shows its output on screen will show an undistorted version of the left eye while showing the fully processed stereo scopic output on the device.