1 /** 2 Pin joint for 3D PhysicsBodies. 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.traits; 17 import godot.core; 18 import godot.c; 19 import godot.d.bind; 20 import godot.d.reference; 21 import godot.globalenums; 22 import godot.object; 23 import godot.classdb; 24 import godot.joint; 25 import godot.spatial; 26 /** 27 Pin joint for 3D PhysicsBodies. 28 29 Pin joint for 3D rigid bodies. It pins 2 bodies (rigid or static) together. See also $(D Generic6DOFJoint). 30 */ 31 @GodotBaseClass struct PinJoint 32 { 33 package(godot) 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 GDNativeClassBinding 41 { 42 __gshared: 43 @GodotName("get_param") GodotMethod!(double, long) getParam; 44 @GodotName("set_param") GodotMethod!(void, long, double) setParam; 45 } 46 /// 47 pragma(inline, true) bool opEquals(in PinJoint other) const 48 { return _godot_object.ptr is other._godot_object.ptr; } 49 /// 50 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 51 { _godot_object.ptr = n; return null; } 52 /// 53 pragma(inline, true) bool opEquals(typeof(null) n) const 54 { return _godot_object.ptr is n; } 55 /// 56 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 57 mixin baseCasts; 58 /// Construct a new instance of PinJoint. 59 /// Note: use `memnew!PinJoint` instead. 60 static PinJoint _new() 61 { 62 static godot_class_constructor constructor; 63 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("PinJoint"); 64 if(constructor is null) return typeof(this).init; 65 return cast(PinJoint)(constructor()); 66 } 67 @disable new(size_t s); 68 /// 69 enum Param : int 70 { 71 /** 72 The force with which the pinned objects stay in positional relation to each other. The higher, the stronger. 73 */ 74 paramBias = 0, 75 /** 76 The force with which the pinned objects stay in velocity relation to each other. The higher, the stronger. 77 */ 78 paramDamping = 1, 79 /** 80 If above 0, this value is the maximum value for an impulse that this Joint produces. 81 */ 82 paramImpulseClamp = 2, 83 } 84 /// 85 enum Constants : int 86 { 87 paramBias = 0, 88 paramDamping = 1, 89 paramImpulseClamp = 2, 90 } 91 /** 92 Returns the value of the specified parameter. 93 */ 94 double getParam(in long param) const 95 { 96 checkClassBinding!(typeof(this))(); 97 return ptrcall!(double)(GDNativeClassBinding.getParam, _godot_object, param); 98 } 99 /** 100 Sets the value of the specified parameter. 101 */ 102 void setParam(in long param, in double value) 103 { 104 checkClassBinding!(typeof(this))(); 105 ptrcall!(void)(GDNativeClassBinding.setParam, _godot_object, param, value); 106 } 107 /** 108 The force with which the pinned objects stay in positional relation to each other. The higher, the stronger. 109 */ 110 @property double paramsBias() 111 { 112 return getParam(0); 113 } 114 /// ditto 115 @property void paramsBias(double v) 116 { 117 setParam(0, v); 118 } 119 /** 120 The force with which the pinned objects stay in velocity relation to each other. The higher, the stronger. 121 */ 122 @property double paramsDamping() 123 { 124 return getParam(1); 125 } 126 /// ditto 127 @property void paramsDamping(double v) 128 { 129 setParam(1, v); 130 } 131 /** 132 If above 0, this value is the maximum value for an impulse that this Joint produces. 133 */ 134 @property double paramsImpulseClamp() 135 { 136 return getParam(2); 137 } 138 /// ditto 139 @property void paramsImpulseClamp(double v) 140 { 141 setParam(2, v); 142 } 143 }