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