1 /** 2 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.physicalbone; 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.physicsbody; 25 /** 26 27 */ 28 @GodotBaseClass struct PhysicalBone 29 { 30 package(godot) enum string _GODOT_internal_name = "PhysicalBone"; 31 public: 32 @nogc nothrow: 33 union { /** */ godot_object _godot_object; /** */ PhysicsBody _GODOT_base; } 34 alias _GODOT_base this; 35 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 36 package(godot) __gshared bool _classBindingInitialized = false; 37 package(godot) static struct GDNativeClassBinding 38 { 39 __gshared: 40 @GodotName("_direct_state_changed") GodotMethod!(void, GodotObject) _directStateChanged; 41 @GodotName("apply_central_impulse") GodotMethod!(void, Vector3) applyCentralImpulse; 42 @GodotName("apply_impulse") GodotMethod!(void, Vector3, Vector3) applyImpulse; 43 @GodotName("get_body_offset") GodotMethod!(Transform) getBodyOffset; 44 @GodotName("get_bone_id") GodotMethod!(long) getBoneId; 45 @GodotName("get_bounce") GodotMethod!(double) getBounce; 46 @GodotName("get_friction") GodotMethod!(double) getFriction; 47 @GodotName("get_gravity_scale") GodotMethod!(double) getGravityScale; 48 @GodotName("get_joint_offset") GodotMethod!(Transform) getJointOffset; 49 @GodotName("get_joint_type") GodotMethod!(PhysicalBone.JointType) getJointType; 50 @GodotName("get_mass") GodotMethod!(double) getMass; 51 @GodotName("get_simulate_physics") GodotMethod!(bool) getSimulatePhysics; 52 @GodotName("get_weight") GodotMethod!(double) getWeight; 53 @GodotName("is_simulating_physics") GodotMethod!(bool) isSimulatingPhysics; 54 @GodotName("is_static_body") GodotMethod!(bool) isStaticBody; 55 @GodotName("set_body_offset") GodotMethod!(void, Transform) setBodyOffset; 56 @GodotName("set_bounce") GodotMethod!(void, double) setBounce; 57 @GodotName("set_friction") GodotMethod!(void, double) setFriction; 58 @GodotName("set_gravity_scale") GodotMethod!(void, double) setGravityScale; 59 @GodotName("set_joint_offset") GodotMethod!(void, Transform) setJointOffset; 60 @GodotName("set_joint_type") GodotMethod!(void, long) setJointType; 61 @GodotName("set_mass") GodotMethod!(void, double) setMass; 62 @GodotName("set_weight") GodotMethod!(void, double) setWeight; 63 } 64 /// 65 pragma(inline, true) bool opEquals(in PhysicalBone other) const 66 { return _godot_object.ptr is other._godot_object.ptr; } 67 /// 68 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 69 { _godot_object.ptr = n; return null; } 70 /// 71 pragma(inline, true) bool opEquals(typeof(null) n) const 72 { return _godot_object.ptr is n; } 73 /// 74 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 75 mixin baseCasts; 76 /// Construct a new instance of PhysicalBone. 77 /// Note: use `memnew!PhysicalBone` instead. 78 static PhysicalBone _new() 79 { 80 static godot_class_constructor constructor; 81 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("PhysicalBone"); 82 if(constructor is null) return typeof(this).init; 83 return cast(PhysicalBone)(constructor()); 84 } 85 @disable new(size_t s); 86 /// 87 enum JointType : int 88 { 89 /** 90 91 */ 92 jointTypeNone = 0, 93 /** 94 95 */ 96 jointTypePin = 1, 97 /** 98 99 */ 100 jointTypeCone = 2, 101 /** 102 103 */ 104 jointTypeHinge = 3, 105 /** 106 107 */ 108 jointTypeSlider = 4, 109 /** 110 111 */ 112 jointType6dof = 5, 113 } 114 /// 115 enum Constants : int 116 { 117 jointTypeNone = 0, 118 jointTypePin = 1, 119 jointTypeCone = 2, 120 jointTypeHinge = 3, 121 jointTypeSlider = 4, 122 jointType6dof = 5, 123 } 124 /** 125 126 */ 127 void _directStateChanged(GodotObject arg0) 128 { 129 Array _GODOT_args = Array.make(); 130 _GODOT_args.append(arg0); 131 String _GODOT_method_name = String("_direct_state_changed"); 132 this.callv(_GODOT_method_name, _GODOT_args); 133 } 134 /** 135 136 */ 137 void applyCentralImpulse(in Vector3 impulse) 138 { 139 checkClassBinding!(typeof(this))(); 140 ptrcall!(void)(GDNativeClassBinding.applyCentralImpulse, _godot_object, impulse); 141 } 142 /** 143 144 */ 145 void applyImpulse(in Vector3 position, in Vector3 impulse) 146 { 147 checkClassBinding!(typeof(this))(); 148 ptrcall!(void)(GDNativeClassBinding.applyImpulse, _godot_object, position, impulse); 149 } 150 /** 151 152 */ 153 Transform getBodyOffset() const 154 { 155 checkClassBinding!(typeof(this))(); 156 return ptrcall!(Transform)(GDNativeClassBinding.getBodyOffset, _godot_object); 157 } 158 /** 159 160 */ 161 long getBoneId() const 162 { 163 checkClassBinding!(typeof(this))(); 164 return ptrcall!(long)(GDNativeClassBinding.getBoneId, _godot_object); 165 } 166 /** 167 168 */ 169 double getBounce() const 170 { 171 checkClassBinding!(typeof(this))(); 172 return ptrcall!(double)(GDNativeClassBinding.getBounce, _godot_object); 173 } 174 /** 175 176 */ 177 double getFriction() const 178 { 179 checkClassBinding!(typeof(this))(); 180 return ptrcall!(double)(GDNativeClassBinding.getFriction, _godot_object); 181 } 182 /** 183 184 */ 185 double getGravityScale() const 186 { 187 checkClassBinding!(typeof(this))(); 188 return ptrcall!(double)(GDNativeClassBinding.getGravityScale, _godot_object); 189 } 190 /** 191 192 */ 193 Transform getJointOffset() const 194 { 195 checkClassBinding!(typeof(this))(); 196 return ptrcall!(Transform)(GDNativeClassBinding.getJointOffset, _godot_object); 197 } 198 /** 199 200 */ 201 PhysicalBone.JointType getJointType() const 202 { 203 checkClassBinding!(typeof(this))(); 204 return ptrcall!(PhysicalBone.JointType)(GDNativeClassBinding.getJointType, _godot_object); 205 } 206 /** 207 208 */ 209 double getMass() const 210 { 211 checkClassBinding!(typeof(this))(); 212 return ptrcall!(double)(GDNativeClassBinding.getMass, _godot_object); 213 } 214 /** 215 216 */ 217 bool getSimulatePhysics() 218 { 219 checkClassBinding!(typeof(this))(); 220 return ptrcall!(bool)(GDNativeClassBinding.getSimulatePhysics, _godot_object); 221 } 222 /** 223 224 */ 225 double getWeight() const 226 { 227 checkClassBinding!(typeof(this))(); 228 return ptrcall!(double)(GDNativeClassBinding.getWeight, _godot_object); 229 } 230 /** 231 232 */ 233 bool isSimulatingPhysics() 234 { 235 checkClassBinding!(typeof(this))(); 236 return ptrcall!(bool)(GDNativeClassBinding.isSimulatingPhysics, _godot_object); 237 } 238 /** 239 240 */ 241 bool isStaticBody() 242 { 243 checkClassBinding!(typeof(this))(); 244 return ptrcall!(bool)(GDNativeClassBinding.isStaticBody, _godot_object); 245 } 246 /** 247 248 */ 249 void setBodyOffset(in Transform offset) 250 { 251 checkClassBinding!(typeof(this))(); 252 ptrcall!(void)(GDNativeClassBinding.setBodyOffset, _godot_object, offset); 253 } 254 /** 255 256 */ 257 void setBounce(in double bounce) 258 { 259 checkClassBinding!(typeof(this))(); 260 ptrcall!(void)(GDNativeClassBinding.setBounce, _godot_object, bounce); 261 } 262 /** 263 264 */ 265 void setFriction(in double friction) 266 { 267 checkClassBinding!(typeof(this))(); 268 ptrcall!(void)(GDNativeClassBinding.setFriction, _godot_object, friction); 269 } 270 /** 271 272 */ 273 void setGravityScale(in double gravity_scale) 274 { 275 checkClassBinding!(typeof(this))(); 276 ptrcall!(void)(GDNativeClassBinding.setGravityScale, _godot_object, gravity_scale); 277 } 278 /** 279 280 */ 281 void setJointOffset(in Transform offset) 282 { 283 checkClassBinding!(typeof(this))(); 284 ptrcall!(void)(GDNativeClassBinding.setJointOffset, _godot_object, offset); 285 } 286 /** 287 288 */ 289 void setJointType(in long joint_type) 290 { 291 checkClassBinding!(typeof(this))(); 292 ptrcall!(void)(GDNativeClassBinding.setJointType, _godot_object, joint_type); 293 } 294 /** 295 296 */ 297 void setMass(in double mass) 298 { 299 checkClassBinding!(typeof(this))(); 300 ptrcall!(void)(GDNativeClassBinding.setMass, _godot_object, mass); 301 } 302 /** 303 304 */ 305 void setWeight(in double weight) 306 { 307 checkClassBinding!(typeof(this))(); 308 ptrcall!(void)(GDNativeClassBinding.setWeight, _godot_object, weight); 309 } 310 /** 311 312 */ 313 @property Transform bodyOffset() 314 { 315 return getBodyOffset(); 316 } 317 /// ditto 318 @property void bodyOffset(Transform v) 319 { 320 setBodyOffset(v); 321 } 322 /** 323 324 */ 325 @property double bounce() 326 { 327 return getBounce(); 328 } 329 /// ditto 330 @property void bounce(double v) 331 { 332 setBounce(v); 333 } 334 /** 335 336 */ 337 @property double friction() 338 { 339 return getFriction(); 340 } 341 /// ditto 342 @property void friction(double v) 343 { 344 setFriction(v); 345 } 346 /** 347 348 */ 349 @property double gravityScale() 350 { 351 return getGravityScale(); 352 } 353 /// ditto 354 @property void gravityScale(double v) 355 { 356 setGravityScale(v); 357 } 358 /** 359 360 */ 361 @property Transform jointOffset() 362 { 363 return getJointOffset(); 364 } 365 /// ditto 366 @property void jointOffset(Transform v) 367 { 368 setJointOffset(v); 369 } 370 /** 371 372 */ 373 @property PhysicalBone.JointType jointType() 374 { 375 return getJointType(); 376 } 377 /// ditto 378 @property void jointType(long v) 379 { 380 setJointType(v); 381 } 382 /** 383 384 */ 385 @property double mass() 386 { 387 return getMass(); 388 } 389 /// ditto 390 @property void mass(double v) 391 { 392 setMass(v); 393 } 394 /** 395 396 */ 397 @property double weight() 398 { 399 return getWeight(); 400 } 401 /// ditto 402 @property void weight(double v) 403 { 404 setWeight(v); 405 } 406 }