1 /** 2 Server interface for low-level 2D physics access. 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.physics2dserver; 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.physics2ddirectbodystate; 24 import godot.physics2dtestmotionresult; 25 import godot.physics2ddirectspacestate; 26 /** 27 Server interface for low-level 2D physics access. 28 29 Physics2DServer is the server responsible for all 2D physics. It can create many kinds of physics objects, but does not insert them on the node tree. 30 */ 31 @GodotBaseClass struct Physics2DServerSingleton 32 { 33 package(godot) enum string _GODOT_internal_name = "Physics2DServer"; 34 public: 35 @nogc nothrow: 36 union { /** */ godot_object _godot_object; /** */ GodotObject _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 godot_object _singleton; 44 immutable char* _singletonName = "Physics2DServer"; 45 @GodotName("area_add_shape") GodotMethod!(void, RID, RID, Transform2D, bool) areaAddShape; 46 @GodotName("area_attach_canvas_instance_id") GodotMethod!(void, RID, long) areaAttachCanvasInstanceId; 47 @GodotName("area_attach_object_instance_id") GodotMethod!(void, RID, long) areaAttachObjectInstanceId; 48 @GodotName("area_clear_shapes") GodotMethod!(void, RID) areaClearShapes; 49 @GodotName("area_create") GodotMethod!(RID) areaCreate; 50 @GodotName("area_get_canvas_instance_id") GodotMethod!(long, RID) areaGetCanvasInstanceId; 51 @GodotName("area_get_object_instance_id") GodotMethod!(long, RID) areaGetObjectInstanceId; 52 @GodotName("area_get_param") GodotMethod!(Variant, RID, long) areaGetParam; 53 @GodotName("area_get_shape") GodotMethod!(RID, RID, long) areaGetShape; 54 @GodotName("area_get_shape_count") GodotMethod!(long, RID) areaGetShapeCount; 55 @GodotName("area_get_shape_transform") GodotMethod!(Transform2D, RID, long) areaGetShapeTransform; 56 @GodotName("area_get_space") GodotMethod!(RID, RID) areaGetSpace; 57 @GodotName("area_get_space_override_mode") GodotMethod!(Physics2DServer.AreaSpaceOverrideMode, RID) areaGetSpaceOverrideMode; 58 @GodotName("area_get_transform") GodotMethod!(Transform2D, RID) areaGetTransform; 59 @GodotName("area_remove_shape") GodotMethod!(void, RID, long) areaRemoveShape; 60 @GodotName("area_set_area_monitor_callback") GodotMethod!(void, RID, GodotObject, String) areaSetAreaMonitorCallback; 61 @GodotName("area_set_collision_layer") GodotMethod!(void, RID, long) areaSetCollisionLayer; 62 @GodotName("area_set_collision_mask") GodotMethod!(void, RID, long) areaSetCollisionMask; 63 @GodotName("area_set_monitor_callback") GodotMethod!(void, RID, GodotObject, String) areaSetMonitorCallback; 64 @GodotName("area_set_monitorable") GodotMethod!(void, RID, bool) areaSetMonitorable; 65 @GodotName("area_set_param") GodotMethod!(void, RID, long, Variant) areaSetParam; 66 @GodotName("area_set_shape") GodotMethod!(void, RID, long, RID) areaSetShape; 67 @GodotName("area_set_shape_disabled") GodotMethod!(void, RID, long, bool) areaSetShapeDisabled; 68 @GodotName("area_set_shape_transform") GodotMethod!(void, RID, long, Transform2D) areaSetShapeTransform; 69 @GodotName("area_set_space") GodotMethod!(void, RID, RID) areaSetSpace; 70 @GodotName("area_set_space_override_mode") GodotMethod!(void, RID, long) areaSetSpaceOverrideMode; 71 @GodotName("area_set_transform") GodotMethod!(void, RID, Transform2D) areaSetTransform; 72 @GodotName("body_add_central_force") GodotMethod!(void, RID, Vector2) bodyAddCentralForce; 73 @GodotName("body_add_collision_exception") GodotMethod!(void, RID, RID) bodyAddCollisionException; 74 @GodotName("body_add_force") GodotMethod!(void, RID, Vector2, Vector2) bodyAddForce; 75 @GodotName("body_add_shape") GodotMethod!(void, RID, RID, Transform2D, bool) bodyAddShape; 76 @GodotName("body_add_torque") GodotMethod!(void, RID, double) bodyAddTorque; 77 @GodotName("body_apply_central_impulse") GodotMethod!(void, RID, Vector2) bodyApplyCentralImpulse; 78 @GodotName("body_apply_impulse") GodotMethod!(void, RID, Vector2, Vector2) bodyApplyImpulse; 79 @GodotName("body_apply_torque_impulse") GodotMethod!(void, RID, double) bodyApplyTorqueImpulse; 80 @GodotName("body_attach_canvas_instance_id") GodotMethod!(void, RID, long) bodyAttachCanvasInstanceId; 81 @GodotName("body_attach_object_instance_id") GodotMethod!(void, RID, long) bodyAttachObjectInstanceId; 82 @GodotName("body_clear_shapes") GodotMethod!(void, RID) bodyClearShapes; 83 @GodotName("body_create") GodotMethod!(RID) bodyCreate; 84 @GodotName("body_get_canvas_instance_id") GodotMethod!(long, RID) bodyGetCanvasInstanceId; 85 @GodotName("body_get_collision_layer") GodotMethod!(long, RID) bodyGetCollisionLayer; 86 @GodotName("body_get_collision_mask") GodotMethod!(long, RID) bodyGetCollisionMask; 87 @GodotName("body_get_continuous_collision_detection_mode") GodotMethod!(Physics2DServer.CCDMode, RID) bodyGetContinuousCollisionDetectionMode; 88 @GodotName("body_get_direct_state") GodotMethod!(Physics2DDirectBodyState, RID) bodyGetDirectState; 89 @GodotName("body_get_max_contacts_reported") GodotMethod!(long, RID) bodyGetMaxContactsReported; 90 @GodotName("body_get_mode") GodotMethod!(Physics2DServer.BodyMode, RID) bodyGetMode; 91 @GodotName("body_get_object_instance_id") GodotMethod!(long, RID) bodyGetObjectInstanceId; 92 @GodotName("body_get_param") GodotMethod!(double, RID, long) bodyGetParam; 93 @GodotName("body_get_shape") GodotMethod!(RID, RID, long) bodyGetShape; 94 @GodotName("body_get_shape_count") GodotMethod!(long, RID) bodyGetShapeCount; 95 @GodotName("body_get_shape_metadata") GodotMethod!(Variant, RID, long) bodyGetShapeMetadata; 96 @GodotName("body_get_shape_transform") GodotMethod!(Transform2D, RID, long) bodyGetShapeTransform; 97 @GodotName("body_get_space") GodotMethod!(RID, RID) bodyGetSpace; 98 @GodotName("body_get_state") GodotMethod!(Variant, RID, long) bodyGetState; 99 @GodotName("body_is_omitting_force_integration") GodotMethod!(bool, RID) bodyIsOmittingForceIntegration; 100 @GodotName("body_remove_collision_exception") GodotMethod!(void, RID, RID) bodyRemoveCollisionException; 101 @GodotName("body_remove_shape") GodotMethod!(void, RID, long) bodyRemoveShape; 102 @GodotName("body_set_axis_velocity") GodotMethod!(void, RID, Vector2) bodySetAxisVelocity; 103 @GodotName("body_set_collision_layer") GodotMethod!(void, RID, long) bodySetCollisionLayer; 104 @GodotName("body_set_collision_mask") GodotMethod!(void, RID, long) bodySetCollisionMask; 105 @GodotName("body_set_continuous_collision_detection_mode") GodotMethod!(void, RID, long) bodySetContinuousCollisionDetectionMode; 106 @GodotName("body_set_force_integration_callback") GodotMethod!(void, RID, GodotObject, String, Variant) bodySetForceIntegrationCallback; 107 @GodotName("body_set_max_contacts_reported") GodotMethod!(void, RID, long) bodySetMaxContactsReported; 108 @GodotName("body_set_mode") GodotMethod!(void, RID, long) bodySetMode; 109 @GodotName("body_set_omit_force_integration") GodotMethod!(void, RID, bool) bodySetOmitForceIntegration; 110 @GodotName("body_set_param") GodotMethod!(void, RID, long, double) bodySetParam; 111 @GodotName("body_set_shape") GodotMethod!(void, RID, long, RID) bodySetShape; 112 @GodotName("body_set_shape_as_one_way_collision") GodotMethod!(void, RID, long, bool, double) bodySetShapeAsOneWayCollision; 113 @GodotName("body_set_shape_disabled") GodotMethod!(void, RID, long, bool) bodySetShapeDisabled; 114 @GodotName("body_set_shape_metadata") GodotMethod!(void, RID, long, Variant) bodySetShapeMetadata; 115 @GodotName("body_set_shape_transform") GodotMethod!(void, RID, long, Transform2D) bodySetShapeTransform; 116 @GodotName("body_set_space") GodotMethod!(void, RID, RID) bodySetSpace; 117 @GodotName("body_set_state") GodotMethod!(void, RID, long, Variant) bodySetState; 118 @GodotName("body_test_motion") GodotMethod!(bool, RID, Transform2D, Vector2, bool, double, Physics2DTestMotionResult) bodyTestMotion; 119 @GodotName("capsule_shape_create") GodotMethod!(RID) capsuleShapeCreate; 120 @GodotName("circle_shape_create") GodotMethod!(RID) circleShapeCreate; 121 @GodotName("concave_polygon_shape_create") GodotMethod!(RID) concavePolygonShapeCreate; 122 @GodotName("convex_polygon_shape_create") GodotMethod!(RID) convexPolygonShapeCreate; 123 @GodotName("damped_spring_joint_create") GodotMethod!(RID, Vector2, Vector2, RID, RID) dampedSpringJointCreate; 124 @GodotName("damped_string_joint_get_param") GodotMethod!(double, RID, long) dampedStringJointGetParam; 125 @GodotName("damped_string_joint_set_param") GodotMethod!(void, RID, long, double) dampedStringJointSetParam; 126 @GodotName("free_rid") GodotMethod!(void, RID) freeRid; 127 @GodotName("get_process_info") GodotMethod!(long, long) getProcessInfo; 128 @GodotName("groove_joint_create") GodotMethod!(RID, Vector2, Vector2, Vector2, RID, RID) grooveJointCreate; 129 @GodotName("joint_get_param") GodotMethod!(double, RID, long) jointGetParam; 130 @GodotName("joint_get_type") GodotMethod!(Physics2DServer.JointType, RID) jointGetType; 131 @GodotName("joint_set_param") GodotMethod!(void, RID, long, double) jointSetParam; 132 @GodotName("line_shape_create") GodotMethod!(RID) lineShapeCreate; 133 @GodotName("pin_joint_create") GodotMethod!(RID, Vector2, RID, RID) pinJointCreate; 134 @GodotName("ray_shape_create") GodotMethod!(RID) rayShapeCreate; 135 @GodotName("rectangle_shape_create") GodotMethod!(RID) rectangleShapeCreate; 136 @GodotName("segment_shape_create") GodotMethod!(RID) segmentShapeCreate; 137 @GodotName("set_active") GodotMethod!(void, bool) setActive; 138 @GodotName("shape_get_data") GodotMethod!(Variant, RID) shapeGetData; 139 @GodotName("shape_get_type") GodotMethod!(Physics2DServer.ShapeType, RID) shapeGetType; 140 @GodotName("shape_set_data") GodotMethod!(void, RID, Variant) shapeSetData; 141 @GodotName("space_create") GodotMethod!(RID) spaceCreate; 142 @GodotName("space_get_direct_state") GodotMethod!(Physics2DDirectSpaceState, RID) spaceGetDirectState; 143 @GodotName("space_get_param") GodotMethod!(double, RID, long) spaceGetParam; 144 @GodotName("space_is_active") GodotMethod!(bool, RID) spaceIsActive; 145 @GodotName("space_set_active") GodotMethod!(void, RID, bool) spaceSetActive; 146 @GodotName("space_set_param") GodotMethod!(void, RID, long, double) spaceSetParam; 147 } 148 /// 149 pragma(inline, true) bool opEquals(in Physics2DServerSingleton other) const 150 { return _godot_object.ptr is other._godot_object.ptr; } 151 /// 152 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 153 { _godot_object.ptr = n; return null; } 154 /// 155 pragma(inline, true) bool opEquals(typeof(null) n) const 156 { return _godot_object.ptr is n; } 157 /// 158 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 159 mixin baseCasts; 160 /// Construct a new instance of Physics2DServerSingleton. 161 /// Note: use `memnew!Physics2DServerSingleton` instead. 162 static Physics2DServerSingleton _new() 163 { 164 static godot_class_constructor constructor; 165 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("Physics2DServer"); 166 if(constructor is null) return typeof(this).init; 167 return cast(Physics2DServerSingleton)(constructor()); 168 } 169 @disable new(size_t s); 170 /// 171 enum ProcessInfo : int 172 { 173 /** 174 Constant to get the number of objects that are not sleeping. 175 */ 176 infoActiveObjects = 0, 177 /** 178 Constant to get the number of possible collisions. 179 */ 180 infoCollisionPairs = 1, 181 /** 182 Constant to get the number of space regions where a collision could occur. 183 */ 184 infoIslandCount = 2, 185 } 186 /// 187 enum AreaBodyStatus : int 188 { 189 /** 190 The value of the first parameter and area callback function receives, when an object enters one of its shapes. 191 */ 192 areaBodyAdded = 0, 193 /** 194 The value of the first parameter and area callback function receives, when an object exits one of its shapes. 195 */ 196 areaBodyRemoved = 1, 197 } 198 /// 199 enum DampedStringParam : int 200 { 201 /** 202 Sets the resting length of the spring joint. The joint will always try to go to back this length when pulled apart. 203 */ 204 dampedStringRestLength = 0, 205 /** 206 Sets the stiffness of the spring joint. The joint applies a force equal to the stiffness times the distance from its resting length. 207 */ 208 dampedStringStiffness = 1, 209 /** 210 Sets the damping ratio of the spring joint. A value of 0 indicates an undamped spring, while 1 causes the system to reach equilibrium as fast as possible (critical damping). 211 */ 212 dampedStringDamping = 2, 213 } 214 /// 215 enum BodyMode : int 216 { 217 /** 218 Constant for static bodies. 219 */ 220 bodyModeStatic = 0, 221 /** 222 Constant for kinematic bodies. 223 */ 224 bodyModeKinematic = 1, 225 /** 226 Constant for rigid bodies. 227 */ 228 bodyModeRigid = 2, 229 /** 230 Constant for rigid bodies in character mode. In this mode, a body can not rotate, and only its linear velocity is affected by physics. 231 */ 232 bodyModeCharacter = 3, 233 } 234 /// 235 enum ShapeType : int 236 { 237 /** 238 This is the constant for creating line shapes. A line shape is an infinite line with an origin point, and a normal. Thus, it can be used for front/behind checks. 239 */ 240 shapeLine = 0, 241 /** 242 243 */ 244 shapeRay = 1, 245 /** 246 This is the constant for creating segment shapes. A segment shape is a line from a point A to a point B. It can be checked for intersections. 247 */ 248 shapeSegment = 2, 249 /** 250 This is the constant for creating circle shapes. A circle shape only has a radius. It can be used for intersections and inside/outside checks. 251 */ 252 shapeCircle = 3, 253 /** 254 This is the constant for creating rectangle shapes. A rectangle shape is defined by a width and a height. It can be used for intersections and inside/outside checks. 255 */ 256 shapeRectangle = 4, 257 /** 258 This is the constant for creating capsule shapes. A capsule shape is defined by a radius and a length. It can be used for intersections and inside/outside checks. 259 */ 260 shapeCapsule = 5, 261 /** 262 This is the constant for creating convex polygon shapes. A polygon is defined by a list of points. It can be used for intersections and inside/outside checks. Unlike the $(D CollisionPolygon2D.polygon) property, polygons modified with $(D shapeSetData) do not verify that the points supplied form is a convex polygon. 263 */ 264 shapeConvexPolygon = 6, 265 /** 266 This is the constant for creating concave polygon shapes. A polygon is defined by a list of points. It can be used for intersections checks, but not for inside/outside checks. 267 */ 268 shapeConcavePolygon = 7, 269 /** 270 This constant is used internally by the engine. Any attempt to create this kind of shape results in an error. 271 */ 272 shapeCustom = 8, 273 } 274 /// 275 enum JointParam : int 276 { 277 /** 278 279 */ 280 jointParamBias = 0, 281 /** 282 283 */ 284 jointParamMaxBias = 1, 285 /** 286 287 */ 288 jointParamMaxForce = 2, 289 } 290 /// 291 enum SpaceParameter : int 292 { 293 /** 294 Constant to set/get the maximum distance a pair of bodies has to move before their collision status has to be recalculated. 295 */ 296 spaceParamContactRecycleRadius = 0, 297 /** 298 Constant to set/get the maximum distance a shape can be from another before they are considered separated. 299 */ 300 spaceParamContactMaxSeparation = 1, 301 /** 302 Constant to set/get the maximum distance a shape can penetrate another shape before it is considered a collision. 303 */ 304 spaceParamBodyMaxAllowedPenetration = 2, 305 /** 306 Constant to set/get the threshold linear velocity of activity. A body marked as potentially inactive for both linear and angular velocity will be put to sleep after the time given. 307 */ 308 spaceParamBodyLinearVelocitySleepThreshold = 3, 309 /** 310 Constant to set/get the threshold angular velocity of activity. A body marked as potentially inactive for both linear and angular velocity will be put to sleep after the time given. 311 */ 312 spaceParamBodyAngularVelocitySleepThreshold = 4, 313 /** 314 Constant to set/get the maximum time of activity. A body marked as potentially inactive for both linear and angular velocity will be put to sleep after this time. 315 */ 316 spaceParamBodyTimeToSleep = 5, 317 /** 318 Constant to set/get the default solver bias for all physics constraints. A solver bias is a factor controlling how much two objects "rebound", after violating a constraint, to avoid leaving them in that state because of numerical imprecision. 319 */ 320 spaceParamConstraintDefaultBias = 6, 321 /** 322 323 */ 324 spaceParamTestMotionMinContactDepth = 7, 325 } 326 /// 327 enum JointType : int 328 { 329 /** 330 Constant to create pin joints. 331 */ 332 jointPin = 0, 333 /** 334 Constant to create groove joints. 335 */ 336 jointGroove = 1, 337 /** 338 Constant to create damped spring joints. 339 */ 340 jointDampedSpring = 2, 341 } 342 /// 343 enum CCDMode : int 344 { 345 /** 346 Disables continuous collision detection. This is the fastest way to detect body collisions, but can miss small, fast-moving objects. 347 */ 348 ccdModeDisabled = 0, 349 /** 350 Enables continuous collision detection by raycasting. It is faster than shapecasting, but less precise. 351 */ 352 ccdModeCastRay = 1, 353 /** 354 Enables continuous collision detection by shapecasting. It is the slowest CCD method, and the most precise. 355 */ 356 ccdModeCastShape = 2, 357 } 358 /// 359 enum BodyState : int 360 { 361 /** 362 Constant to set/get the current transform matrix of the body. 363 */ 364 bodyStateTransform = 0, 365 /** 366 Constant to set/get the current linear velocity of the body. 367 */ 368 bodyStateLinearVelocity = 1, 369 /** 370 Constant to set/get the current angular velocity of the body. 371 */ 372 bodyStateAngularVelocity = 2, 373 /** 374 Constant to sleep/wake up a body, or to get whether it is sleeping. 375 */ 376 bodyStateSleeping = 3, 377 /** 378 Constant to set/get whether the body can sleep. 379 */ 380 bodyStateCanSleep = 4, 381 } 382 /// 383 enum BodyParameter : int 384 { 385 /** 386 Constant to set/get a body's bounce factor. 387 */ 388 bodyParamBounce = 0, 389 /** 390 Constant to set/get a body's friction. 391 */ 392 bodyParamFriction = 1, 393 /** 394 Constant to set/get a body's mass. 395 */ 396 bodyParamMass = 2, 397 /** 398 Constant to set/get a body's inertia. 399 */ 400 bodyParamInertia = 3, 401 /** 402 Constant to set/get a body's gravity multiplier. 403 */ 404 bodyParamGravityScale = 4, 405 /** 406 Constant to set/get a body's linear dampening factor. 407 */ 408 bodyParamLinearDamp = 5, 409 /** 410 Constant to set/get a body's angular dampening factor. 411 */ 412 bodyParamAngularDamp = 6, 413 /** 414 Represents the size of the $(D bodyparameter) enum. 415 */ 416 bodyParamMax = 7, 417 } 418 /// 419 enum AreaSpaceOverrideMode : int 420 { 421 /** 422 This area does not affect gravity/damp. These are generally areas that exist only to detect collisions, and objects entering or exiting them. 423 */ 424 areaSpaceOverrideDisabled = 0, 425 /** 426 This area adds its gravity/damp values to whatever has been calculated so far. This way, many overlapping areas can combine their physics to make interesting effects. 427 */ 428 areaSpaceOverrideCombine = 1, 429 /** 430 This area adds its gravity/damp values to whatever has been calculated so far. Then stops taking into account the rest of the areas, even the default one. 431 */ 432 areaSpaceOverrideCombineReplace = 2, 433 /** 434 This area replaces any gravity/damp, even the default one, and stops taking into account the rest of the areas. 435 */ 436 areaSpaceOverrideReplace = 3, 437 /** 438 This area replaces any gravity/damp calculated so far, but keeps calculating the rest of the areas, down to the default one. 439 */ 440 areaSpaceOverrideReplaceCombine = 4, 441 } 442 /// 443 enum AreaParameter : int 444 { 445 /** 446 Constant to set/get gravity strength in an area. 447 */ 448 areaParamGravity = 0, 449 /** 450 Constant to set/get gravity vector/center in an area. 451 */ 452 areaParamGravityVector = 1, 453 /** 454 Constant to set/get whether the gravity vector of an area is a direction, or a center point. 455 */ 456 areaParamGravityIsPoint = 2, 457 /** 458 Constant to set/get the falloff factor for point gravity of an area. The greater this value is, the faster the strength of gravity decreases with the square of distance. 459 */ 460 areaParamGravityDistanceScale = 3, 461 /** 462 This constant was used to set/get the falloff factor for point gravity. It has been superseded by $(D constant AREA_PARAM_GRAVITY_DISTANCE_SCALE). 463 */ 464 areaParamGravityPointAttenuation = 4, 465 /** 466 Constant to set/get the linear dampening factor of an area. 467 */ 468 areaParamLinearDamp = 5, 469 /** 470 Constant to set/get the angular dampening factor of an area. 471 */ 472 areaParamAngularDamp = 6, 473 /** 474 Constant to set/get the priority (order of processing) of an area. 475 */ 476 areaParamPriority = 7, 477 } 478 /// 479 enum Constants : int 480 { 481 dampedStringRestLength = 0, 482 bodyParamBounce = 0, 483 ccdModeDisabled = 0, 484 spaceParamContactRecycleRadius = 0, 485 areaBodyAdded = 0, 486 bodyStateTransform = 0, 487 areaParamGravity = 0, 488 infoActiveObjects = 0, 489 jointParamBias = 0, 490 areaSpaceOverrideDisabled = 0, 491 jointPin = 0, 492 shapeLine = 0, 493 bodyModeStatic = 0, 494 areaBodyRemoved = 1, 495 jointGroove = 1, 496 bodyParamFriction = 1, 497 bodyStateLinearVelocity = 1, 498 areaSpaceOverrideCombine = 1, 499 ccdModeCastRay = 1, 500 spaceParamContactMaxSeparation = 1, 501 jointParamMaxBias = 1, 502 areaParamGravityVector = 1, 503 bodyModeKinematic = 1, 504 shapeRay = 1, 505 dampedStringStiffness = 1, 506 infoCollisionPairs = 1, 507 spaceParamBodyMaxAllowedPenetration = 2, 508 dampedStringDamping = 2, 509 infoIslandCount = 2, 510 ccdModeCastShape = 2, 511 jointParamMaxForce = 2, 512 bodyStateAngularVelocity = 2, 513 jointDampedSpring = 2, 514 bodyModeRigid = 2, 515 bodyParamMass = 2, 516 shapeSegment = 2, 517 areaSpaceOverrideCombineReplace = 2, 518 areaParamGravityIsPoint = 2, 519 bodyParamInertia = 3, 520 areaSpaceOverrideReplace = 3, 521 shapeCircle = 3, 522 bodyModeCharacter = 3, 523 areaParamGravityDistanceScale = 3, 524 spaceParamBodyLinearVelocitySleepThreshold = 3, 525 bodyStateSleeping = 3, 526 spaceParamBodyAngularVelocitySleepThreshold = 4, 527 areaParamGravityPointAttenuation = 4, 528 bodyParamGravityScale = 4, 529 areaSpaceOverrideReplaceCombine = 4, 530 bodyStateCanSleep = 4, 531 shapeRectangle = 4, 532 bodyParamLinearDamp = 5, 533 spaceParamBodyTimeToSleep = 5, 534 areaParamLinearDamp = 5, 535 shapeCapsule = 5, 536 spaceParamConstraintDefaultBias = 6, 537 bodyParamAngularDamp = 6, 538 areaParamAngularDamp = 6, 539 shapeConvexPolygon = 6, 540 spaceParamTestMotionMinContactDepth = 7, 541 bodyParamMax = 7, 542 areaParamPriority = 7, 543 shapeConcavePolygon = 7, 544 shapeCustom = 8, 545 } 546 /** 547 Adds a shape to the area, along with a transform matrix. Shapes are usually referenced by their index, so you should track which shape has a given index. 548 */ 549 void areaAddShape(in RID area, in RID shape, in Transform2D transform = Transform2D.init, in bool disabled = false) 550 { 551 checkClassBinding!(typeof(this))(); 552 ptrcall!(void)(GDNativeClassBinding.areaAddShape, _godot_object, area, shape, transform, disabled); 553 } 554 /** 555 556 */ 557 void areaAttachCanvasInstanceId(in RID area, in long id) 558 { 559 checkClassBinding!(typeof(this))(); 560 ptrcall!(void)(GDNativeClassBinding.areaAttachCanvasInstanceId, _godot_object, area, id); 561 } 562 /** 563 Assigns the area to a descendant of $(D GodotObject), so it can exist in the node tree. 564 */ 565 void areaAttachObjectInstanceId(in RID area, in long id) 566 { 567 checkClassBinding!(typeof(this))(); 568 ptrcall!(void)(GDNativeClassBinding.areaAttachObjectInstanceId, _godot_object, area, id); 569 } 570 /** 571 Removes all shapes from an area. It does not delete the shapes, so they can be reassigned later. 572 */ 573 void areaClearShapes(in RID area) 574 { 575 checkClassBinding!(typeof(this))(); 576 ptrcall!(void)(GDNativeClassBinding.areaClearShapes, _godot_object, area); 577 } 578 /** 579 Creates an $(D Area2D). After creating an $(D Area2D) with this method, assign it to a space using $(D areaSetSpace) to use the created $(D Area2D) in the physics world. 580 */ 581 RID areaCreate() 582 { 583 checkClassBinding!(typeof(this))(); 584 return ptrcall!(RID)(GDNativeClassBinding.areaCreate, _godot_object); 585 } 586 /** 587 588 */ 589 long areaGetCanvasInstanceId(in RID area) const 590 { 591 checkClassBinding!(typeof(this))(); 592 return ptrcall!(long)(GDNativeClassBinding.areaGetCanvasInstanceId, _godot_object, area); 593 } 594 /** 595 Gets the instance ID of the object the area is assigned to. 596 */ 597 long areaGetObjectInstanceId(in RID area) const 598 { 599 checkClassBinding!(typeof(this))(); 600 return ptrcall!(long)(GDNativeClassBinding.areaGetObjectInstanceId, _godot_object, area); 601 } 602 /** 603 Returns an area parameter value. See $(D areaparameter) for a list of available parameters. 604 */ 605 Variant areaGetParam(in RID area, in long param) const 606 { 607 checkClassBinding!(typeof(this))(); 608 return ptrcall!(Variant)(GDNativeClassBinding.areaGetParam, _godot_object, area, param); 609 } 610 /** 611 Returns the $(D RID) of the nth shape of an area. 612 */ 613 RID areaGetShape(in RID area, in long shape_idx) const 614 { 615 checkClassBinding!(typeof(this))(); 616 return ptrcall!(RID)(GDNativeClassBinding.areaGetShape, _godot_object, area, shape_idx); 617 } 618 /** 619 Returns the number of shapes assigned to an area. 620 */ 621 long areaGetShapeCount(in RID area) const 622 { 623 checkClassBinding!(typeof(this))(); 624 return ptrcall!(long)(GDNativeClassBinding.areaGetShapeCount, _godot_object, area); 625 } 626 /** 627 Returns the transform matrix of a shape within an area. 628 */ 629 Transform2D areaGetShapeTransform(in RID area, in long shape_idx) const 630 { 631 checkClassBinding!(typeof(this))(); 632 return ptrcall!(Transform2D)(GDNativeClassBinding.areaGetShapeTransform, _godot_object, area, shape_idx); 633 } 634 /** 635 Returns the space assigned to the area. 636 */ 637 RID areaGetSpace(in RID area) const 638 { 639 checkClassBinding!(typeof(this))(); 640 return ptrcall!(RID)(GDNativeClassBinding.areaGetSpace, _godot_object, area); 641 } 642 /** 643 Returns the space override mode for the area. 644 */ 645 Physics2DServer.AreaSpaceOverrideMode areaGetSpaceOverrideMode(in RID area) const 646 { 647 checkClassBinding!(typeof(this))(); 648 return ptrcall!(Physics2DServer.AreaSpaceOverrideMode)(GDNativeClassBinding.areaGetSpaceOverrideMode, _godot_object, area); 649 } 650 /** 651 Returns the transform matrix for an area. 652 */ 653 Transform2D areaGetTransform(in RID area) const 654 { 655 checkClassBinding!(typeof(this))(); 656 return ptrcall!(Transform2D)(GDNativeClassBinding.areaGetTransform, _godot_object, area); 657 } 658 /** 659 Removes a shape from an area. It does not delete the shape, so it can be reassigned later. 660 */ 661 void areaRemoveShape(in RID area, in long shape_idx) 662 { 663 checkClassBinding!(typeof(this))(); 664 ptrcall!(void)(GDNativeClassBinding.areaRemoveShape, _godot_object, area, shape_idx); 665 } 666 /** 667 668 */ 669 void areaSetAreaMonitorCallback(in RID area, GodotObject receiver, in String method) 670 { 671 checkClassBinding!(typeof(this))(); 672 ptrcall!(void)(GDNativeClassBinding.areaSetAreaMonitorCallback, _godot_object, area, receiver, method); 673 } 674 /** 675 Assigns the area to one or many physics layers. 676 */ 677 void areaSetCollisionLayer(in RID area, in long layer) 678 { 679 checkClassBinding!(typeof(this))(); 680 ptrcall!(void)(GDNativeClassBinding.areaSetCollisionLayer, _godot_object, area, layer); 681 } 682 /** 683 Sets which physics layers the area will monitor. 684 */ 685 void areaSetCollisionMask(in RID area, in long mask) 686 { 687 checkClassBinding!(typeof(this))(); 688 ptrcall!(void)(GDNativeClassBinding.areaSetCollisionMask, _godot_object, area, mask); 689 } 690 /** 691 Sets the function to call when any body/area enters or exits the area. This callback will be called for any object interacting with the area, and takes five parameters: 692 1: $(D constant AREA_BODY_ADDED) or $(D constant AREA_BODY_REMOVED), depending on whether the object entered or exited the area. 693 2: $(D RID) of the object that entered/exited the area. 694 3: Instance ID of the object that entered/exited the area. 695 4: The shape index of the object that entered/exited the area. 696 5: The shape index of the area where the object entered/exited. 697 */ 698 void areaSetMonitorCallback(in RID area, GodotObject receiver, in String method) 699 { 700 checkClassBinding!(typeof(this))(); 701 ptrcall!(void)(GDNativeClassBinding.areaSetMonitorCallback, _godot_object, area, receiver, method); 702 } 703 /** 704 705 */ 706 void areaSetMonitorable(in RID area, in bool monitorable) 707 { 708 checkClassBinding!(typeof(this))(); 709 ptrcall!(void)(GDNativeClassBinding.areaSetMonitorable, _godot_object, area, monitorable); 710 } 711 /** 712 Sets the value for an area parameter. See $(D areaparameter) for a list of available parameters. 713 */ 714 void areaSetParam(VariantArg2)(in RID area, in long param, in VariantArg2 value) 715 { 716 checkClassBinding!(typeof(this))(); 717 ptrcall!(void)(GDNativeClassBinding.areaSetParam, _godot_object, area, param, value); 718 } 719 /** 720 Substitutes a given area shape by another. The old shape is selected by its index, the new one by its $(D RID). 721 */ 722 void areaSetShape(in RID area, in long shape_idx, in RID shape) 723 { 724 checkClassBinding!(typeof(this))(); 725 ptrcall!(void)(GDNativeClassBinding.areaSetShape, _godot_object, area, shape_idx, shape); 726 } 727 /** 728 Disables a given shape in an area. 729 */ 730 void areaSetShapeDisabled(in RID area, in long shape_idx, in bool disabled) 731 { 732 checkClassBinding!(typeof(this))(); 733 ptrcall!(void)(GDNativeClassBinding.areaSetShapeDisabled, _godot_object, area, shape_idx, disabled); 734 } 735 /** 736 Sets the transform matrix for an area shape. 737 */ 738 void areaSetShapeTransform(in RID area, in long shape_idx, in Transform2D transform) 739 { 740 checkClassBinding!(typeof(this))(); 741 ptrcall!(void)(GDNativeClassBinding.areaSetShapeTransform, _godot_object, area, shape_idx, transform); 742 } 743 /** 744 Assigns a space to the area. 745 */ 746 void areaSetSpace(in RID area, in RID space) 747 { 748 checkClassBinding!(typeof(this))(); 749 ptrcall!(void)(GDNativeClassBinding.areaSetSpace, _godot_object, area, space); 750 } 751 /** 752 Sets the space override mode for the area. See $(D areaspaceoverridemode) for a list of available modes. 753 */ 754 void areaSetSpaceOverrideMode(in RID area, in long mode) 755 { 756 checkClassBinding!(typeof(this))(); 757 ptrcall!(void)(GDNativeClassBinding.areaSetSpaceOverrideMode, _godot_object, area, mode); 758 } 759 /** 760 Sets the transform matrix for an area. 761 */ 762 void areaSetTransform(in RID area, in Transform2D transform) 763 { 764 checkClassBinding!(typeof(this))(); 765 ptrcall!(void)(GDNativeClassBinding.areaSetTransform, _godot_object, area, transform); 766 } 767 /** 768 769 */ 770 void bodyAddCentralForce(in RID _body, in Vector2 force) 771 { 772 checkClassBinding!(typeof(this))(); 773 ptrcall!(void)(GDNativeClassBinding.bodyAddCentralForce, _godot_object, _body, force); 774 } 775 /** 776 Adds a body to the list of bodies exempt from collisions. 777 */ 778 void bodyAddCollisionException(in RID _body, in RID excepted_body) 779 { 780 checkClassBinding!(typeof(this))(); 781 ptrcall!(void)(GDNativeClassBinding.bodyAddCollisionException, _godot_object, _body, excepted_body); 782 } 783 /** 784 Adds a positioned force to the applied force and torque. As with $(D bodyApplyImpulse), both the force and the offset from the body origin are in global coordinates. A force differs from an impulse in that, while the two are forces, the impulse clears itself after being applied. 785 */ 786 void bodyAddForce(in RID _body, in Vector2 offset, in Vector2 force) 787 { 788 checkClassBinding!(typeof(this))(); 789 ptrcall!(void)(GDNativeClassBinding.bodyAddForce, _godot_object, _body, offset, force); 790 } 791 /** 792 Adds a shape to the body, along with a transform matrix. Shapes are usually referenced by their index, so you should track which shape has a given index. 793 */ 794 void bodyAddShape(in RID _body, in RID shape, in Transform2D transform = Transform2D.init, in bool disabled = false) 795 { 796 checkClassBinding!(typeof(this))(); 797 ptrcall!(void)(GDNativeClassBinding.bodyAddShape, _godot_object, _body, shape, transform, disabled); 798 } 799 /** 800 801 */ 802 void bodyAddTorque(in RID _body, in double torque) 803 { 804 checkClassBinding!(typeof(this))(); 805 ptrcall!(void)(GDNativeClassBinding.bodyAddTorque, _godot_object, _body, torque); 806 } 807 /** 808 809 */ 810 void bodyApplyCentralImpulse(in RID _body, in Vector2 impulse) 811 { 812 checkClassBinding!(typeof(this))(); 813 ptrcall!(void)(GDNativeClassBinding.bodyApplyCentralImpulse, _godot_object, _body, impulse); 814 } 815 /** 816 Adds a positioned impulse to the applied force and torque. Both the force and the offset from the body origin are in global coordinates. 817 */ 818 void bodyApplyImpulse(in RID _body, in Vector2 position, in Vector2 impulse) 819 { 820 checkClassBinding!(typeof(this))(); 821 ptrcall!(void)(GDNativeClassBinding.bodyApplyImpulse, _godot_object, _body, position, impulse); 822 } 823 /** 824 825 */ 826 void bodyApplyTorqueImpulse(in RID _body, in double impulse) 827 { 828 checkClassBinding!(typeof(this))(); 829 ptrcall!(void)(GDNativeClassBinding.bodyApplyTorqueImpulse, _godot_object, _body, impulse); 830 } 831 /** 832 833 */ 834 void bodyAttachCanvasInstanceId(in RID _body, in long id) 835 { 836 checkClassBinding!(typeof(this))(); 837 ptrcall!(void)(GDNativeClassBinding.bodyAttachCanvasInstanceId, _godot_object, _body, id); 838 } 839 /** 840 Assigns the area to a descendant of $(D GodotObject), so it can exist in the node tree. 841 */ 842 void bodyAttachObjectInstanceId(in RID _body, in long id) 843 { 844 checkClassBinding!(typeof(this))(); 845 ptrcall!(void)(GDNativeClassBinding.bodyAttachObjectInstanceId, _godot_object, _body, id); 846 } 847 /** 848 Removes all shapes from a body. 849 */ 850 void bodyClearShapes(in RID _body) 851 { 852 checkClassBinding!(typeof(this))(); 853 ptrcall!(void)(GDNativeClassBinding.bodyClearShapes, _godot_object, _body); 854 } 855 /** 856 Creates a physics body. 857 */ 858 RID bodyCreate() 859 { 860 checkClassBinding!(typeof(this))(); 861 return ptrcall!(RID)(GDNativeClassBinding.bodyCreate, _godot_object); 862 } 863 /** 864 865 */ 866 long bodyGetCanvasInstanceId(in RID _body) const 867 { 868 checkClassBinding!(typeof(this))(); 869 return ptrcall!(long)(GDNativeClassBinding.bodyGetCanvasInstanceId, _godot_object, _body); 870 } 871 /** 872 Returns the physics layer or layers a body belongs to. 873 */ 874 long bodyGetCollisionLayer(in RID _body) const 875 { 876 checkClassBinding!(typeof(this))(); 877 return ptrcall!(long)(GDNativeClassBinding.bodyGetCollisionLayer, _godot_object, _body); 878 } 879 /** 880 Returns the physics layer or layers a body can collide with. 881 */ 882 long bodyGetCollisionMask(in RID _body) const 883 { 884 checkClassBinding!(typeof(this))(); 885 return ptrcall!(long)(GDNativeClassBinding.bodyGetCollisionMask, _godot_object, _body); 886 } 887 /** 888 Returns the continuous collision detection mode. 889 */ 890 Physics2DServer.CCDMode bodyGetContinuousCollisionDetectionMode(in RID _body) const 891 { 892 checkClassBinding!(typeof(this))(); 893 return ptrcall!(Physics2DServer.CCDMode)(GDNativeClassBinding.bodyGetContinuousCollisionDetectionMode, _godot_object, _body); 894 } 895 /** 896 Returns the $(D Physics2DDirectBodyState) of the body. 897 */ 898 Physics2DDirectBodyState bodyGetDirectState(in RID _body) 899 { 900 checkClassBinding!(typeof(this))(); 901 return ptrcall!(Physics2DDirectBodyState)(GDNativeClassBinding.bodyGetDirectState, _godot_object, _body); 902 } 903 /** 904 Returns the maximum contacts that can be reported. See $(D bodySetMaxContactsReported). 905 */ 906 long bodyGetMaxContactsReported(in RID _body) const 907 { 908 checkClassBinding!(typeof(this))(); 909 return ptrcall!(long)(GDNativeClassBinding.bodyGetMaxContactsReported, _godot_object, _body); 910 } 911 /** 912 Returns the body mode. 913 */ 914 Physics2DServer.BodyMode bodyGetMode(in RID _body) const 915 { 916 checkClassBinding!(typeof(this))(); 917 return ptrcall!(Physics2DServer.BodyMode)(GDNativeClassBinding.bodyGetMode, _godot_object, _body); 918 } 919 /** 920 Gets the instance ID of the object the area is assigned to. 921 */ 922 long bodyGetObjectInstanceId(in RID _body) const 923 { 924 checkClassBinding!(typeof(this))(); 925 return ptrcall!(long)(GDNativeClassBinding.bodyGetObjectInstanceId, _godot_object, _body); 926 } 927 /** 928 Returns the value of a body parameter. See $(D bodyparameter) for a list of available parameters. 929 */ 930 double bodyGetParam(in RID _body, in long param) const 931 { 932 checkClassBinding!(typeof(this))(); 933 return ptrcall!(double)(GDNativeClassBinding.bodyGetParam, _godot_object, _body, param); 934 } 935 /** 936 Returns the $(D RID) of the nth shape of a body. 937 */ 938 RID bodyGetShape(in RID _body, in long shape_idx) const 939 { 940 checkClassBinding!(typeof(this))(); 941 return ptrcall!(RID)(GDNativeClassBinding.bodyGetShape, _godot_object, _body, shape_idx); 942 } 943 /** 944 Returns the number of shapes assigned to a body. 945 */ 946 long bodyGetShapeCount(in RID _body) const 947 { 948 checkClassBinding!(typeof(this))(); 949 return ptrcall!(long)(GDNativeClassBinding.bodyGetShapeCount, _godot_object, _body); 950 } 951 /** 952 Returns the metadata of a shape of a body. 953 */ 954 Variant bodyGetShapeMetadata(in RID _body, in long shape_idx) const 955 { 956 checkClassBinding!(typeof(this))(); 957 return ptrcall!(Variant)(GDNativeClassBinding.bodyGetShapeMetadata, _godot_object, _body, shape_idx); 958 } 959 /** 960 Returns the transform matrix of a body shape. 961 */ 962 Transform2D bodyGetShapeTransform(in RID _body, in long shape_idx) const 963 { 964 checkClassBinding!(typeof(this))(); 965 return ptrcall!(Transform2D)(GDNativeClassBinding.bodyGetShapeTransform, _godot_object, _body, shape_idx); 966 } 967 /** 968 Returns the $(D RID) of the space assigned to a body. 969 */ 970 RID bodyGetSpace(in RID _body) const 971 { 972 checkClassBinding!(typeof(this))(); 973 return ptrcall!(RID)(GDNativeClassBinding.bodyGetSpace, _godot_object, _body); 974 } 975 /** 976 Returns a body state. 977 */ 978 Variant bodyGetState(in RID _body, in long state) const 979 { 980 checkClassBinding!(typeof(this))(); 981 return ptrcall!(Variant)(GDNativeClassBinding.bodyGetState, _godot_object, _body, state); 982 } 983 /** 984 Returns whether a body uses a callback function to calculate its own physics (see $(D bodySetForceIntegrationCallback)). 985 */ 986 bool bodyIsOmittingForceIntegration(in RID _body) const 987 { 988 checkClassBinding!(typeof(this))(); 989 return ptrcall!(bool)(GDNativeClassBinding.bodyIsOmittingForceIntegration, _godot_object, _body); 990 } 991 /** 992 Removes a body from the list of bodies exempt from collisions. 993 */ 994 void bodyRemoveCollisionException(in RID _body, in RID excepted_body) 995 { 996 checkClassBinding!(typeof(this))(); 997 ptrcall!(void)(GDNativeClassBinding.bodyRemoveCollisionException, _godot_object, _body, excepted_body); 998 } 999 /** 1000 Removes a shape from a body. The shape is not deleted, so it can be reused afterwards. 1001 */ 1002 void bodyRemoveShape(in RID _body, in long shape_idx) 1003 { 1004 checkClassBinding!(typeof(this))(); 1005 ptrcall!(void)(GDNativeClassBinding.bodyRemoveShape, _godot_object, _body, shape_idx); 1006 } 1007 /** 1008 Sets an axis velocity. The velocity in the given vector axis will be set as the given vector length. This is useful for jumping behavior. 1009 */ 1010 void bodySetAxisVelocity(in RID _body, in Vector2 axis_velocity) 1011 { 1012 checkClassBinding!(typeof(this))(); 1013 ptrcall!(void)(GDNativeClassBinding.bodySetAxisVelocity, _godot_object, _body, axis_velocity); 1014 } 1015 /** 1016 Sets the physics layer or layers a body belongs to. 1017 */ 1018 void bodySetCollisionLayer(in RID _body, in long layer) 1019 { 1020 checkClassBinding!(typeof(this))(); 1021 ptrcall!(void)(GDNativeClassBinding.bodySetCollisionLayer, _godot_object, _body, layer); 1022 } 1023 /** 1024 Sets the physics layer or layers a body can collide with. 1025 */ 1026 void bodySetCollisionMask(in RID _body, in long mask) 1027 { 1028 checkClassBinding!(typeof(this))(); 1029 ptrcall!(void)(GDNativeClassBinding.bodySetCollisionMask, _godot_object, _body, mask); 1030 } 1031 /** 1032 Sets the continuous collision detection mode using one of the $(D ccdmode) constants. 1033 Continuous collision detection tries to predict where a moving body will collide, instead of moving it and correcting its movement if it collided. 1034 */ 1035 void bodySetContinuousCollisionDetectionMode(in RID _body, in long mode) 1036 { 1037 checkClassBinding!(typeof(this))(); 1038 ptrcall!(void)(GDNativeClassBinding.bodySetContinuousCollisionDetectionMode, _godot_object, _body, mode); 1039 } 1040 /** 1041 Sets the function used to calculate physics for an object, if that object allows it (see $(D bodySetOmitForceIntegration)). 1042 */ 1043 void bodySetForceIntegrationCallback(VariantArg3)(in RID _body, GodotObject receiver, in String method, in VariantArg3 userdata = Variant.nil) 1044 { 1045 checkClassBinding!(typeof(this))(); 1046 ptrcall!(void)(GDNativeClassBinding.bodySetForceIntegrationCallback, _godot_object, _body, receiver, method, userdata); 1047 } 1048 /** 1049 Sets the maximum contacts to report. Bodies can keep a log of the contacts with other bodies, this is enabled by setting the maximum amount of contacts reported to a number greater than 0. 1050 */ 1051 void bodySetMaxContactsReported(in RID _body, in long amount) 1052 { 1053 checkClassBinding!(typeof(this))(); 1054 ptrcall!(void)(GDNativeClassBinding.bodySetMaxContactsReported, _godot_object, _body, amount); 1055 } 1056 /** 1057 Sets the body mode using one of the $(D bodymode) constants. 1058 */ 1059 void bodySetMode(in RID _body, in long mode) 1060 { 1061 checkClassBinding!(typeof(this))(); 1062 ptrcall!(void)(GDNativeClassBinding.bodySetMode, _godot_object, _body, mode); 1063 } 1064 /** 1065 Sets whether a body uses a callback function to calculate its own physics (see $(D bodySetForceIntegrationCallback)). 1066 */ 1067 void bodySetOmitForceIntegration(in RID _body, in bool enable) 1068 { 1069 checkClassBinding!(typeof(this))(); 1070 ptrcall!(void)(GDNativeClassBinding.bodySetOmitForceIntegration, _godot_object, _body, enable); 1071 } 1072 /** 1073 Sets a body parameter. See $(D bodyparameter) for a list of available parameters. 1074 */ 1075 void bodySetParam(in RID _body, in long param, in double value) 1076 { 1077 checkClassBinding!(typeof(this))(); 1078 ptrcall!(void)(GDNativeClassBinding.bodySetParam, _godot_object, _body, param, value); 1079 } 1080 /** 1081 Substitutes a given body shape by another. The old shape is selected by its index, the new one by its $(D RID). 1082 */ 1083 void bodySetShape(in RID _body, in long shape_idx, in RID shape) 1084 { 1085 checkClassBinding!(typeof(this))(); 1086 ptrcall!(void)(GDNativeClassBinding.bodySetShape, _godot_object, _body, shape_idx, shape); 1087 } 1088 /** 1089 Enables one way collision on body if `enable` is `true`. 1090 */ 1091 void bodySetShapeAsOneWayCollision(in RID _body, in long shape_idx, in bool enable, in double margin) 1092 { 1093 checkClassBinding!(typeof(this))(); 1094 ptrcall!(void)(GDNativeClassBinding.bodySetShapeAsOneWayCollision, _godot_object, _body, shape_idx, enable, margin); 1095 } 1096 /** 1097 Disables shape in body if `disable` is `true`. 1098 */ 1099 void bodySetShapeDisabled(in RID _body, in long shape_idx, in bool disabled) 1100 { 1101 checkClassBinding!(typeof(this))(); 1102 ptrcall!(void)(GDNativeClassBinding.bodySetShapeDisabled, _godot_object, _body, shape_idx, disabled); 1103 } 1104 /** 1105 Sets metadata of a shape within a body. This metadata is different from $(D GodotObject.setMeta), and can be retrieved on shape queries. 1106 */ 1107 void bodySetShapeMetadata(VariantArg2)(in RID _body, in long shape_idx, in VariantArg2 metadata) 1108 { 1109 checkClassBinding!(typeof(this))(); 1110 ptrcall!(void)(GDNativeClassBinding.bodySetShapeMetadata, _godot_object, _body, shape_idx, metadata); 1111 } 1112 /** 1113 Sets the transform matrix for a body shape. 1114 */ 1115 void bodySetShapeTransform(in RID _body, in long shape_idx, in Transform2D transform) 1116 { 1117 checkClassBinding!(typeof(this))(); 1118 ptrcall!(void)(GDNativeClassBinding.bodySetShapeTransform, _godot_object, _body, shape_idx, transform); 1119 } 1120 /** 1121 Assigns a space to the body (see $(D spaceCreate)). 1122 */ 1123 void bodySetSpace(in RID _body, in RID space) 1124 { 1125 checkClassBinding!(typeof(this))(); 1126 ptrcall!(void)(GDNativeClassBinding.bodySetSpace, _godot_object, _body, space); 1127 } 1128 /** 1129 Sets a body state using one of the $(D bodystate) constants. 1130 Note that the method doesn't take effect immediately. The state will change on the next physics frame. 1131 */ 1132 void bodySetState(VariantArg2)(in RID _body, in long state, in VariantArg2 value) 1133 { 1134 checkClassBinding!(typeof(this))(); 1135 ptrcall!(void)(GDNativeClassBinding.bodySetState, _godot_object, _body, state, value); 1136 } 1137 /** 1138 Returns `true` if a collision would result from moving in the given direction from a given point in space. Margin increases the size of the shapes involved in the collision detection. $(D Physics2DTestMotionResult) can be passed to return additional information in. 1139 */ 1140 bool bodyTestMotion(in RID _body, in Transform2D from, in Vector2 motion, in bool infinite_inertia, in double margin = 0.08, Physics2DTestMotionResult result = Physics2DTestMotionResult.init) 1141 { 1142 checkClassBinding!(typeof(this))(); 1143 return ptrcall!(bool)(GDNativeClassBinding.bodyTestMotion, _godot_object, _body, from, motion, infinite_inertia, margin, result); 1144 } 1145 /** 1146 1147 */ 1148 RID capsuleShapeCreate() 1149 { 1150 checkClassBinding!(typeof(this))(); 1151 return ptrcall!(RID)(GDNativeClassBinding.capsuleShapeCreate, _godot_object); 1152 } 1153 /** 1154 1155 */ 1156 RID circleShapeCreate() 1157 { 1158 checkClassBinding!(typeof(this))(); 1159 return ptrcall!(RID)(GDNativeClassBinding.circleShapeCreate, _godot_object); 1160 } 1161 /** 1162 1163 */ 1164 RID concavePolygonShapeCreate() 1165 { 1166 checkClassBinding!(typeof(this))(); 1167 return ptrcall!(RID)(GDNativeClassBinding.concavePolygonShapeCreate, _godot_object); 1168 } 1169 /** 1170 1171 */ 1172 RID convexPolygonShapeCreate() 1173 { 1174 checkClassBinding!(typeof(this))(); 1175 return ptrcall!(RID)(GDNativeClassBinding.convexPolygonShapeCreate, _godot_object); 1176 } 1177 /** 1178 Creates a damped spring joint between two bodies. If not specified, the second body is assumed to be the joint itself. 1179 */ 1180 RID dampedSpringJointCreate(in Vector2 anchor_a, in Vector2 anchor_b, in RID body_a, in RID body_b = RID.init) 1181 { 1182 checkClassBinding!(typeof(this))(); 1183 return ptrcall!(RID)(GDNativeClassBinding.dampedSpringJointCreate, _godot_object, anchor_a, anchor_b, body_a, body_b); 1184 } 1185 /** 1186 Returns the value of a damped spring joint parameter. 1187 */ 1188 double dampedStringJointGetParam(in RID joint, in long param) const 1189 { 1190 checkClassBinding!(typeof(this))(); 1191 return ptrcall!(double)(GDNativeClassBinding.dampedStringJointGetParam, _godot_object, joint, param); 1192 } 1193 /** 1194 Sets a damped spring joint parameter. See $(D dampedstringparam) for a list of available parameters. 1195 */ 1196 void dampedStringJointSetParam(in RID joint, in long param, in double value) 1197 { 1198 checkClassBinding!(typeof(this))(); 1199 ptrcall!(void)(GDNativeClassBinding.dampedStringJointSetParam, _godot_object, joint, param, value); 1200 } 1201 /** 1202 Destroys any of the objects created by Physics2DServer. If the $(D RID) passed is not one of the objects that can be created by Physics2DServer, an error will be sent to the console. 1203 */ 1204 void freeRid(in RID rid) 1205 { 1206 checkClassBinding!(typeof(this))(); 1207 ptrcall!(void)(GDNativeClassBinding.freeRid, _godot_object, rid); 1208 } 1209 /** 1210 Returns information about the current state of the 2D physics engine. See $(D processinfo) for a list of available states. 1211 */ 1212 long getProcessInfo(in long process_info) 1213 { 1214 checkClassBinding!(typeof(this))(); 1215 return ptrcall!(long)(GDNativeClassBinding.getProcessInfo, _godot_object, process_info); 1216 } 1217 /** 1218 Creates a groove joint between two bodies. If not specified, the bodies are assumed to be the joint itself. 1219 */ 1220 RID grooveJointCreate(in Vector2 groove1_a, in Vector2 groove2_a, in Vector2 anchor_b, in RID body_a = RID.init, in RID body_b = RID.init) 1221 { 1222 checkClassBinding!(typeof(this))(); 1223 return ptrcall!(RID)(GDNativeClassBinding.grooveJointCreate, _godot_object, groove1_a, groove2_a, anchor_b, body_a, body_b); 1224 } 1225 /** 1226 Returns the value of a joint parameter. 1227 */ 1228 double jointGetParam(in RID joint, in long param) const 1229 { 1230 checkClassBinding!(typeof(this))(); 1231 return ptrcall!(double)(GDNativeClassBinding.jointGetParam, _godot_object, joint, param); 1232 } 1233 /** 1234 Returns a joint's type (see $(D jointtype)). 1235 */ 1236 Physics2DServer.JointType jointGetType(in RID joint) const 1237 { 1238 checkClassBinding!(typeof(this))(); 1239 return ptrcall!(Physics2DServer.JointType)(GDNativeClassBinding.jointGetType, _godot_object, joint); 1240 } 1241 /** 1242 Sets a joint parameter. See $(D jointparam) for a list of available parameters. 1243 */ 1244 void jointSetParam(in RID joint, in long param, in double value) 1245 { 1246 checkClassBinding!(typeof(this))(); 1247 ptrcall!(void)(GDNativeClassBinding.jointSetParam, _godot_object, joint, param, value); 1248 } 1249 /** 1250 1251 */ 1252 RID lineShapeCreate() 1253 { 1254 checkClassBinding!(typeof(this))(); 1255 return ptrcall!(RID)(GDNativeClassBinding.lineShapeCreate, _godot_object); 1256 } 1257 /** 1258 Creates a pin joint between two bodies. If not specified, the second body is assumed to be the joint itself. 1259 */ 1260 RID pinJointCreate(in Vector2 anchor, in RID body_a, in RID body_b = RID.init) 1261 { 1262 checkClassBinding!(typeof(this))(); 1263 return ptrcall!(RID)(GDNativeClassBinding.pinJointCreate, _godot_object, anchor, body_a, body_b); 1264 } 1265 /** 1266 1267 */ 1268 RID rayShapeCreate() 1269 { 1270 checkClassBinding!(typeof(this))(); 1271 return ptrcall!(RID)(GDNativeClassBinding.rayShapeCreate, _godot_object); 1272 } 1273 /** 1274 1275 */ 1276 RID rectangleShapeCreate() 1277 { 1278 checkClassBinding!(typeof(this))(); 1279 return ptrcall!(RID)(GDNativeClassBinding.rectangleShapeCreate, _godot_object); 1280 } 1281 /** 1282 1283 */ 1284 RID segmentShapeCreate() 1285 { 1286 checkClassBinding!(typeof(this))(); 1287 return ptrcall!(RID)(GDNativeClassBinding.segmentShapeCreate, _godot_object); 1288 } 1289 /** 1290 Activates or deactivates the 2D physics engine. 1291 */ 1292 void setActive(in bool active) 1293 { 1294 checkClassBinding!(typeof(this))(); 1295 ptrcall!(void)(GDNativeClassBinding.setActive, _godot_object, active); 1296 } 1297 /** 1298 Returns the shape data. 1299 */ 1300 Variant shapeGetData(in RID shape) const 1301 { 1302 checkClassBinding!(typeof(this))(); 1303 return ptrcall!(Variant)(GDNativeClassBinding.shapeGetData, _godot_object, shape); 1304 } 1305 /** 1306 Returns a shape's type (see $(D shapetype)). 1307 */ 1308 Physics2DServer.ShapeType shapeGetType(in RID shape) const 1309 { 1310 checkClassBinding!(typeof(this))(); 1311 return ptrcall!(Physics2DServer.ShapeType)(GDNativeClassBinding.shapeGetType, _godot_object, shape); 1312 } 1313 /** 1314 Sets the shape data that defines its shape and size. The data to be passed depends on the kind of shape created $(D shapeGetType). 1315 */ 1316 void shapeSetData(VariantArg1)(in RID shape, in VariantArg1 data) 1317 { 1318 checkClassBinding!(typeof(this))(); 1319 ptrcall!(void)(GDNativeClassBinding.shapeSetData, _godot_object, shape, data); 1320 } 1321 /** 1322 Creates a space. A space is a collection of parameters for the physics engine that can be assigned to an area or a body. It can be assigned to an area with $(D areaSetSpace), or to a body with $(D bodySetSpace). 1323 */ 1324 RID spaceCreate() 1325 { 1326 checkClassBinding!(typeof(this))(); 1327 return ptrcall!(RID)(GDNativeClassBinding.spaceCreate, _godot_object); 1328 } 1329 /** 1330 Returns the state of a space, a $(D Physics2DDirectSpaceState). This object can be used to make collision/intersection queries. 1331 */ 1332 Physics2DDirectSpaceState spaceGetDirectState(in RID space) 1333 { 1334 checkClassBinding!(typeof(this))(); 1335 return ptrcall!(Physics2DDirectSpaceState)(GDNativeClassBinding.spaceGetDirectState, _godot_object, space); 1336 } 1337 /** 1338 Returns the value of a space parameter. 1339 */ 1340 double spaceGetParam(in RID space, in long param) const 1341 { 1342 checkClassBinding!(typeof(this))(); 1343 return ptrcall!(double)(GDNativeClassBinding.spaceGetParam, _godot_object, space, param); 1344 } 1345 /** 1346 Returns whether the space is active. 1347 */ 1348 bool spaceIsActive(in RID space) const 1349 { 1350 checkClassBinding!(typeof(this))(); 1351 return ptrcall!(bool)(GDNativeClassBinding.spaceIsActive, _godot_object, space); 1352 } 1353 /** 1354 Marks a space as active. It will not have an effect, unless it is assigned to an area or body. 1355 */ 1356 void spaceSetActive(in RID space, in bool active) 1357 { 1358 checkClassBinding!(typeof(this))(); 1359 ptrcall!(void)(GDNativeClassBinding.spaceSetActive, _godot_object, space, active); 1360 } 1361 /** 1362 Sets the value for a space parameter. See $(D spaceparameter) for a list of available parameters. 1363 */ 1364 void spaceSetParam(in RID space, in long param, in double value) 1365 { 1366 checkClassBinding!(typeof(this))(); 1367 ptrcall!(void)(GDNativeClassBinding.spaceSetParam, _godot_object, space, param, value); 1368 } 1369 } 1370 /// Returns: the Physics2DServerSingleton 1371 @property @nogc nothrow pragma(inline, true) 1372 Physics2DServerSingleton Physics2DServer() 1373 { 1374 checkClassBinding!Physics2DServerSingleton(); 1375 return Physics2DServerSingleton(Physics2DServerSingleton.GDNativeClassBinding._singleton); 1376 }