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