Documentation
¶
Overview ¶
This is a generic mobile VR implementation where you need to provide details about the phone and HMD used. It does not rely on any existing framework. This is the most basic interface we have. For the best effect, you need a mobile phone with a gyroscope and accelerometer.
Note that even though there is no positional tracking, the camera will assume the headset is at a height of 1.85 meters. You can change this by setting Instance.EyeHeight.
You can initialize this interface as follows:
package main import ( "graphics.gd/classdb/Node" "graphics.gd/classdb/Viewport" "graphics.gd/classdb/XRInterface" "graphics.gd/classdb/XRServer" ) func ExampleMobileVR(node Node.Instance) { var XR = XRServer.FindInterface("Native mobile") if XR != XRInterface.Nil && XR.Initialize() { Viewport.Get(node).SetUseXr(true) } }
Note: For Android, graphics.gd/classdb/ProjectSettings "input_devices/sensors/enable_accelerometer", graphics.gd/classdb/ProjectSettings "input_devices/sensors/enable_gravity", graphics.gd/classdb/ProjectSettings "input_devices/sensors/enable_gyroscope" and graphics.gd/classdb/ProjectSettings "input_devices/sensors/enable_magnetometer" must be enabled.
Index ¶
- type Advanced
- type Any
- type Extension
- type ID
- type Instance
- func (self Instance) AsMobileVRInterface() Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) AsXRInterface() XRInterface.Instance
- func (self Instance) DisplayToLens() Float.X
- func (self Instance) DisplayWidth() Float.X
- func (self Instance) EyeHeight() Float.X
- func (self Instance) ID() ID
- func (self Instance) Iod() Float.X
- func (self Instance) K1() Float.X
- func (self Instance) K2() Float.X
- func (self Instance) OffsetRect() Rect2.PositionSize
- func (self Instance) Oversample() Float.X
- func (self Instance) SetDisplayToLens(value Float.X)
- func (self Instance) SetDisplayWidth(value Float.X)
- func (self Instance) SetEyeHeight(value Float.X)
- func (self Instance) SetIod(value Float.X)
- func (self Instance) SetK1(value Float.X)
- func (self Instance) SetK2(value Float.X)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetOffsetRect(value Rect2.PositionSize)
- func (self Instance) SetOversample(value Float.X)
- func (self Instance) SetVrsMinRadius(value Float.X)
- func (self Instance) SetVrsStrength(value Float.X)
- func (self Instance) Virtual(name string) reflect.Value
- func (self Instance) VrsMinRadius() Float.X
- func (self Instance) VrsStrength() Float.X
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension
func (*Extension[T]) AsMobileVRInterface ¶
func (*Extension[T]) AsRefCounted ¶
func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted
func (*Extension[T]) AsXRInterface ¶
func (self *Extension[T]) AsXRInterface() XRInterface.Instance
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Instance ¶
type Instance [1]gdclass.MobileVRInterface
Instance of the class with convieniently typed arguments and results.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AsMobileVRInterface ¶
func (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
func (Instance) AsXRInterface ¶
func (self Instance) AsXRInterface() XRInterface.Instance
func (Instance) DisplayToLens ¶
func (Instance) DisplayWidth ¶
func (Instance) OffsetRect ¶
func (self Instance) OffsetRect() Rect2.PositionSize
func (Instance) Oversample ¶
func (Instance) SetDisplayToLens ¶
func (Instance) SetDisplayWidth ¶
func (Instance) SetEyeHeight ¶
func (Instance) SetOffsetRect ¶
func (self Instance) SetOffsetRect(value Rect2.PositionSize)