1 /** 2 Pin Joint for 3D Shapes. 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.pinjoint; 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.joint; 24 import godot.spatial; 25 import godot.node; 26 /** 27 Pin Joint for 3D Shapes. 28 29 Pin Joint for 3D Rigid Bodies. It pins 2 bodies (rigid or static) together. 30 */ 31 @GodotBaseClass struct PinJoint 32 { 33 enum string _GODOT_internal_name = "PinJoint"; 34 public: 35 @nogc nothrow: 36 union { godot_object _godot_object; Joint _GODOT_base; } 37 alias _GODOT_base this; 38 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 39 package(godot) __gshared bool _classBindingInitialized = false; 40 package(godot) static struct _classBinding 41 { 42 __gshared: 43 @GodotName("set_param") GodotMethod!(void, long, double) setParam; 44 @GodotName("get_param") GodotMethod!(double, long) getParam; 45 } 46 bool opEquals(in PinJoint other) const { return _godot_object.ptr is other._godot_object.ptr; } 47 PinJoint opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; } 48 bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; } 49 mixin baseCasts; 50 static PinJoint _new() 51 { 52 static godot_class_constructor constructor; 53 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("PinJoint"); 54 if(constructor is null) return typeof(this).init; 55 return cast(PinJoint)(constructor()); 56 } 57 @disable new(size_t s); 58 /// 59 enum Param : int 60 { 61 /** 62 The force with which the pinned objects stay in positional relation to each other. 63 The higher, the stronger. 64 */ 65 paramBias = 0, 66 /** 67 The force with which the pinned objects stay in velocity relation to each other. 68 The higher, the stronger. 69 */ 70 paramDamping = 1, 71 /** 72 If above 0, this value is the maximum value for an impulse that this Joint produces. 73 */ 74 paramImpulseClamp = 2, 75 } 76 /// 77 enum Constants : int 78 { 79 paramBias = 0, 80 paramDamping = 1, 81 paramImpulseClamp = 2, 82 } 83 /** 84 85 */ 86 void setParam(in long param, in double value) 87 { 88 checkClassBinding!(typeof(this))(); 89 ptrcall!(void)(_classBinding.setParam, _godot_object, param, value); 90 } 91 /** 92 93 */ 94 double getParam(in long param) const 95 { 96 checkClassBinding!(typeof(this))(); 97 return ptrcall!(double)(_classBinding.getParam, _godot_object, param); 98 } 99 /** 100 The force with which the pinned objects stay in positional relation to each other. 101 The higher, the stronger. 102 */ 103 @property double paramsBias() 104 { 105 return getParam(0); 106 } 107 /// ditto 108 @property void paramsBias(double v) 109 { 110 setParam(0, v); 111 } 112 /** 113 The force with which the pinned objects stay in velocity relation to each other. 114 The higher, the stronger. 115 */ 116 @property double paramsDamping() 117 { 118 return getParam(1); 119 } 120 /// ditto 121 @property void paramsDamping(double v) 122 { 123 setParam(1, v); 124 } 125 /** 126 If above 0, this value is the maximum value for an impulse that this Joint produces. 127 */ 128 @property double paramsImpulseClamp() 129 { 130 return getParam(2); 131 } 132 /// ditto 133 @property void paramsImpulseClamp(double v) 134 { 135 setParam(2, v); 136 } 137 }