1 /** 2 Our origin point in AR/VR. 3 4 Copyright: 5 Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. 6 Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) 7 Copyright (c) 2017-2018 Godot-D contributors 8 9 License: $(LINK2 https://opensource.org/licenses/MIT, MIT License) 10 11 12 */ 13 module godot.arvrorigin; 14 import std.meta : AliasSeq, staticIndexOf; 15 import std.traits : Unqual; 16 import godot.d.meta; 17 import godot.core; 18 import godot.c; 19 import godot.d.bind; 20 import godot.d.reference; 21 import godot.object; 22 import godot.classdb; 23 import godot.spatial; 24 import godot.node; 25 /** 26 Our origin point in AR/VR. 27 28 This is a special node within the AR/VR system that maps the physical location of the center of our tracking space to the virtual location within our game world. 29 There should be only one of these nodes in your scene and you must have one. All the ARVRCamera, ARVRController and ARVRAnchor nodes should be direct children of this node for spatial tracking to work correctly. 30 It is the position of this node that you update when you're character needs to move through your game world while we're not moving in the real world. Movement in the real world is always in relation to this origin point. 31 So say that your character is driving a car, the ARVROrigin node should be a child node of this car. If you implement a teleport system to move your character, you change the position of this node. Etc. 32 */ 33 @GodotBaseClass struct ARVROrigin 34 { 35 enum string _GODOT_internal_name = "ARVROrigin"; 36 public: 37 @nogc nothrow: 38 union { godot_object _godot_object; Spatial _GODOT_base; } 39 alias _GODOT_base this; 40 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 41 package(godot) __gshared bool _classBindingInitialized = false; 42 package(godot) static struct _classBinding 43 { 44 __gshared: 45 @GodotName("set_world_scale") GodotMethod!(void, double) setWorldScale; 46 @GodotName("get_world_scale") GodotMethod!(double) getWorldScale; 47 } 48 bool opEquals(in ARVROrigin other) const { return _godot_object.ptr is other._godot_object.ptr; } 49 ARVROrigin opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; } 50 bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; } 51 mixin baseCasts; 52 static ARVROrigin _new() 53 { 54 static godot_class_constructor constructor; 55 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("ARVROrigin"); 56 if(constructor is null) return typeof(this).init; 57 return cast(ARVROrigin)(constructor()); 58 } 59 @disable new(size_t s); 60 /** 61 62 */ 63 void setWorldScale(in double world_scale) 64 { 65 checkClassBinding!(typeof(this))(); 66 ptrcall!(void)(_classBinding.setWorldScale, _godot_object, world_scale); 67 } 68 /** 69 70 */ 71 double getWorldScale() const 72 { 73 checkClassBinding!(typeof(this))(); 74 return ptrcall!(double)(_classBinding.getWorldScale, _godot_object); 75 } 76 /** 77 Allows you to adjust the scale to your game's units. Most AR/VR platforms assume a scale of 1 game world unit = 1 meter in the real world. 78 Note that this method is a passthrough to the $(D ARVRServer) itself. 79 */ 80 @property double worldScale() 81 { 82 return getWorldScale(); 83 } 84 /// ditto 85 @property void worldScale(double v) 86 { 87 setWorldScale(v); 88 } 89 }