1 /** 2 Piston kind of slider between two bodies in 3D. 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.sliderjoint; 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 Piston kind of slider between two bodies in 3D. 28 29 Slides across the x-axis of the $(D Pivot) object. 30 */ 31 @GodotBaseClass struct SliderJoint 32 { 33 enum string _GODOT_internal_name = "SliderJoint"; 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 @GodotName("_set_upper_limit_angular") GodotMethod!(void, double) _setUpperLimitAngular; 46 @GodotName("_get_upper_limit_angular") GodotMethod!(double) _getUpperLimitAngular; 47 @GodotName("_set_lower_limit_angular") GodotMethod!(void, double) _setLowerLimitAngular; 48 @GodotName("_get_lower_limit_angular") GodotMethod!(double) _getLowerLimitAngular; 49 } 50 bool opEquals(in SliderJoint other) const { return _godot_object.ptr is other._godot_object.ptr; } 51 SliderJoint opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; } 52 bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; } 53 mixin baseCasts; 54 static SliderJoint _new() 55 { 56 static godot_class_constructor constructor; 57 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("SliderJoint"); 58 if(constructor is null) return typeof(this).init; 59 return cast(SliderJoint)(constructor()); 60 } 61 @disable new(size_t s); 62 /// 63 enum Param : int 64 { 65 /** 66 The maximum difference between the pivot points on their x-axis before damping happens. 67 */ 68 paramLinearLimitUpper = 0, 69 /** 70 The minimum difference between the pivot points on their x-axis before damping happens. 71 */ 72 paramLinearLimitLower = 1, 73 /** 74 A factor applied to the movement across the slider axis once the limits get surpassed. The lower, the slower the movement. 75 */ 76 paramLinearLimitSoftness = 2, 77 /** 78 The amount of restitution once the limits are surpassed. The lower, the more velocityenergy gets lost. 79 */ 80 paramLinearLimitRestitution = 3, 81 /** 82 The amount of damping once the slider limits are surpassed. 83 */ 84 paramLinearLimitDamping = 4, 85 /** 86 A factor applied to the movement across the slider axis as long as the slider is in the limits. The lower, the slower the movement. 87 */ 88 paramLinearMotionSoftness = 5, 89 /** 90 The amount of restitution inside the slider limits. 91 */ 92 paramLinearMotionRestitution = 6, 93 /** 94 The amount of damping inside the slider limits. 95 */ 96 paramLinearMotionDamping = 7, 97 /** 98 A factor applied to the movement across axes orthogonal to the slider. 99 */ 100 paramLinearOrthogonalSoftness = 8, 101 /** 102 The amount of restitution when movement is across axes orthogonal to the slider. 103 */ 104 paramLinearOrthogonalRestitution = 9, 105 /** 106 The amount of damping when movement is across axes orthogonal to the slider. 107 */ 108 paramLinearOrthogonalDamping = 10, 109 /** 110 The upper limit of rotation in the slider. 111 */ 112 paramAngularLimitUpper = 11, 113 /** 114 The lower limit of rotation in the slider. 115 */ 116 paramAngularLimitLower = 12, 117 /** 118 A factor applied to the all rotation once the limit is surpassed. 119 */ 120 paramAngularLimitSoftness = 13, 121 /** 122 The amount of restitution of the rotation when the limit is surpassed. 123 */ 124 paramAngularLimitRestitution = 14, 125 /** 126 The amount of damping of the rotation when the limit is surpassed. 127 */ 128 paramAngularLimitDamping = 15, 129 /** 130 A factor applied to the all rotation in the limits. 131 */ 132 paramAngularMotionSoftness = 16, 133 /** 134 The amount of restitution of the rotation in the limits. 135 */ 136 paramAngularMotionRestitution = 17, 137 /** 138 The amount of damping of the rotation in the limits. 139 */ 140 paramAngularMotionDamping = 18, 141 /** 142 A factor applied to the all rotation across axes orthogonal to the slider. 143 */ 144 paramAngularOrthogonalSoftness = 19, 145 /** 146 The amount of restitution of the rotation across axes orthogonal to the slider. 147 */ 148 paramAngularOrthogonalRestitution = 20, 149 /** 150 The amount of damping of the rotation across axes orthogonal to the slider. 151 */ 152 paramAngularOrthogonalDamping = 21, 153 /** 154 End flag of PARAM_* constants, used internally. 155 */ 156 paramMax = 22, 157 } 158 /// 159 enum Constants : int 160 { 161 paramLinearLimitUpper = 0, 162 paramLinearLimitLower = 1, 163 paramLinearLimitSoftness = 2, 164 paramLinearLimitRestitution = 3, 165 paramLinearLimitDamping = 4, 166 paramLinearMotionSoftness = 5, 167 paramLinearMotionRestitution = 6, 168 paramLinearMotionDamping = 7, 169 paramLinearOrthogonalSoftness = 8, 170 paramLinearOrthogonalRestitution = 9, 171 paramLinearOrthogonalDamping = 10, 172 paramAngularLimitUpper = 11, 173 paramAngularLimitLower = 12, 174 paramAngularLimitSoftness = 13, 175 paramAngularLimitRestitution = 14, 176 paramAngularLimitDamping = 15, 177 paramAngularMotionSoftness = 16, 178 paramAngularMotionRestitution = 17, 179 paramAngularMotionDamping = 18, 180 paramAngularOrthogonalSoftness = 19, 181 paramAngularOrthogonalRestitution = 20, 182 paramAngularOrthogonalDamping = 21, 183 paramMax = 22, 184 } 185 /** 186 187 */ 188 void setParam(in long param, in double value) 189 { 190 checkClassBinding!(typeof(this))(); 191 ptrcall!(void)(_classBinding.setParam, _godot_object, param, value); 192 } 193 /** 194 195 */ 196 double getParam(in long param) const 197 { 198 checkClassBinding!(typeof(this))(); 199 return ptrcall!(double)(_classBinding.getParam, _godot_object, param); 200 } 201 /** 202 203 */ 204 void _setUpperLimitAngular(in double upper_limit_angular) 205 { 206 Array _GODOT_args = Array.empty_array; 207 _GODOT_args.append(upper_limit_angular); 208 String _GODOT_method_name = String("_set_upper_limit_angular"); 209 this.callv(_GODOT_method_name, _GODOT_args); 210 } 211 /** 212 213 */ 214 double _getUpperLimitAngular() const 215 { 216 Array _GODOT_args = Array.empty_array; 217 String _GODOT_method_name = String("_get_upper_limit_angular"); 218 return this.callv(_GODOT_method_name, _GODOT_args).as!(RefOrT!double); 219 } 220 /** 221 222 */ 223 void _setLowerLimitAngular(in double lower_limit_angular) 224 { 225 Array _GODOT_args = Array.empty_array; 226 _GODOT_args.append(lower_limit_angular); 227 String _GODOT_method_name = String("_set_lower_limit_angular"); 228 this.callv(_GODOT_method_name, _GODOT_args); 229 } 230 /** 231 232 */ 233 double _getLowerLimitAngular() const 234 { 235 Array _GODOT_args = Array.empty_array; 236 String _GODOT_method_name = String("_get_lower_limit_angular"); 237 return this.callv(_GODOT_method_name, _GODOT_args).as!(RefOrT!double); 238 } 239 /** 240 The maximum difference between the pivot points on their x-axis before damping happens. 241 */ 242 @property double linearLimitUpperDistance() 243 { 244 return getParam(0); 245 } 246 /// ditto 247 @property void linearLimitUpperDistance(double v) 248 { 249 setParam(0, v); 250 } 251 /** 252 The minimum difference between the pivot points on their x-axis before damping happens. 253 */ 254 @property double linearLimitLowerDistance() 255 { 256 return getParam(1); 257 } 258 /// ditto 259 @property void linearLimitLowerDistance(double v) 260 { 261 setParam(1, v); 262 } 263 /** 264 A factor applied to the movement across the slider axis once the limits get surpassed. The lower, the slower the movement. 265 */ 266 @property double linearLimitSoftness() 267 { 268 return getParam(2); 269 } 270 /// ditto 271 @property void linearLimitSoftness(double v) 272 { 273 setParam(2, v); 274 } 275 /** 276 The amount of restitution once the limits are surpassed. The lower, the more velocity-energy gets lost. 277 */ 278 @property double linearLimitRestitution() 279 { 280 return getParam(3); 281 } 282 /// ditto 283 @property void linearLimitRestitution(double v) 284 { 285 setParam(3, v); 286 } 287 /** 288 The amount of damping that happens once the limit defined by $(D linearLimit/lowerDistance) and $(D linearLimit/upperDistance) is surpassed. 289 */ 290 @property double linearLimitDamping() 291 { 292 return getParam(4); 293 } 294 /// ditto 295 @property void linearLimitDamping(double v) 296 { 297 setParam(4, v); 298 } 299 /** 300 A factor applied to the movement across the slider axis as long as the slider is in the limits. The lower, the slower the movement. 301 */ 302 @property double linearMotionSoftness() 303 { 304 return getParam(5); 305 } 306 /// ditto 307 @property void linearMotionSoftness(double v) 308 { 309 setParam(5, v); 310 } 311 /** 312 The amount of restitution inside the slider limits. 313 */ 314 @property double linearMotionRestitution() 315 { 316 return getParam(6); 317 } 318 /// ditto 319 @property void linearMotionRestitution(double v) 320 { 321 setParam(6, v); 322 } 323 /** 324 The amount of damping inside the slider limits. 325 */ 326 @property double linearMotionDamping() 327 { 328 return getParam(7); 329 } 330 /// ditto 331 @property void linearMotionDamping(double v) 332 { 333 setParam(7, v); 334 } 335 /** 336 A factor applied to the movement across axes orthogonal to the slider. 337 */ 338 @property double linearOrthoSoftness() 339 { 340 return getParam(8); 341 } 342 /// ditto 343 @property void linearOrthoSoftness(double v) 344 { 345 setParam(8, v); 346 } 347 /** 348 The amount of restitution when movement is across axes orthogonal to the slider. 349 */ 350 @property double linearOrthoRestitution() 351 { 352 return getParam(9); 353 } 354 /// ditto 355 @property void linearOrthoRestitution(double v) 356 { 357 setParam(9, v); 358 } 359 /** 360 The amount of damping when movement is across axes orthogonal to the slider. 361 */ 362 @property double linearOrthoDamping() 363 { 364 return getParam(10); 365 } 366 /// ditto 367 @property void linearOrthoDamping(double v) 368 { 369 setParam(10, v); 370 } 371 /** 372 The upper limit of rotation in the slider. 373 */ 374 @property double angularLimitUpperAngle() 375 { 376 return _getUpperLimitAngular(); 377 } 378 /// ditto 379 @property void angularLimitUpperAngle(double v) 380 { 381 _setUpperLimitAngular(v); 382 } 383 /** 384 The lower limit of rotation in the slider. 385 */ 386 @property double angularLimitLowerAngle() 387 { 388 return _getLowerLimitAngular(); 389 } 390 /// ditto 391 @property void angularLimitLowerAngle(double v) 392 { 393 _setLowerLimitAngular(v); 394 } 395 /** 396 A factor applied to the all rotation once the limit is surpassed. 397 Makes all rotation slower when between 0 and 1. 398 */ 399 @property double angularLimitSoftness() 400 { 401 return getParam(13); 402 } 403 /// ditto 404 @property void angularLimitSoftness(double v) 405 { 406 setParam(13, v); 407 } 408 /** 409 The amount of restitution of the rotation when the limit is surpassed. 410 Does not affect damping. 411 */ 412 @property double angularLimitRestitution() 413 { 414 return getParam(14); 415 } 416 /// ditto 417 @property void angularLimitRestitution(double v) 418 { 419 setParam(14, v); 420 } 421 /** 422 The amount of damping of the rotation when the limit is surpassed. 423 A lower damping value allows a rotation initiated by body A to travel to body B slower. 424 */ 425 @property double angularLimitDamping() 426 { 427 return getParam(15); 428 } 429 /// ditto 430 @property void angularLimitDamping(double v) 431 { 432 setParam(15, v); 433 } 434 /** 435 A factor applied to the all rotation in the limits. 436 */ 437 @property double angularMotionSoftness() 438 { 439 return getParam(16); 440 } 441 /// ditto 442 @property void angularMotionSoftness(double v) 443 { 444 setParam(16, v); 445 } 446 /** 447 The amount of restitution of the rotation in the limits. 448 */ 449 @property double angularMotionRestitution() 450 { 451 return getParam(17); 452 } 453 /// ditto 454 @property void angularMotionRestitution(double v) 455 { 456 setParam(17, v); 457 } 458 /** 459 The amount of damping of the rotation in the limits. 460 */ 461 @property double angularMotionDamping() 462 { 463 return getParam(18); 464 } 465 /// ditto 466 @property void angularMotionDamping(double v) 467 { 468 setParam(18, v); 469 } 470 /** 471 A factor applied to the all rotation across axes orthogonal to the slider. 472 */ 473 @property double angularOrthoSoftness() 474 { 475 return getParam(19); 476 } 477 /// ditto 478 @property void angularOrthoSoftness(double v) 479 { 480 setParam(19, v); 481 } 482 /** 483 The amount of restitution of the rotation across axes orthogonal to the slider. 484 */ 485 @property double angularOrthoRestitution() 486 { 487 return getParam(20); 488 } 489 /// ditto 490 @property void angularOrthoRestitution(double v) 491 { 492 setParam(20, v); 493 } 494 /** 495 The amount of damping of the rotation across axes orthogonal to the slider. 496 */ 497 @property double angularOrthoDamping() 498 { 499 return getParam(21); 500 } 501 /// ditto 502 @property void angularOrthoDamping(double v) 503 { 504 setParam(21, v); 505 } 506 }