1 /**
2 A body that is controlled by the 2D physics engine.
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.rigidbody2d;
14 import std.meta : AliasSeq, staticIndexOf;
15 import std.traits : Unqual;
16 import godot.d.traits;
17 import godot.core;
18 import godot.c;
19 import godot.d.bind;
20 import godot.d.reference;
21 import godot.globalenums;
22 import godot.object;
23 import godot.classdb;
24 import godot.physicsbody2d;
25 import godot.collisionobject2d;
26 import godot.node2d;
27 import godot.canvasitem;
28 import godot.node;
29 import godot.physics2ddirectbodystate;
30 import godot.physicsmaterial;
31 import godot.physics2dtestmotionresult;
32 /**
33 A body that is controlled by the 2D physics engine.
34 
35 This node implements simulated 2D physics. You do not control a RigidBody2D directly. Instead, you apply forces to it (gravity, impulses, etc.) and the physics simulation calculates the resulting movement based on its mass, friction, and other physical properties.
36 A RigidBody2D has 4 behavior $(D mode)s: Rigid, Static, Character, and Kinematic.
37 $(B Note:) You should not change a RigidBody2D's `position` or `linear_velocity` every frame or even very often. If you need to directly affect the body's state, use $(D _integrateForces), which allows you to directly access the physics state.
38 Please also keep in mind that physics bodies manage their own transform which overwrites the ones you set. So any direct or indirect transformation (including scaling of the node or its parent) will be visible in the editor only, and immediately reset at runtime.
39 If you need to override the default physics behavior or add a transformation at runtime, you can write a custom force integration. See $(D customIntegrator).
40 The center of mass is always located at the node's origin without taking into account the $(D CollisionShape2D) centroid offsets.
41 */
42 @GodotBaseClass struct RigidBody2D
43 {
44 	package(godot) enum string _GODOT_internal_name = "RigidBody2D";
45 public:
46 @nogc nothrow:
47 	union { /** */ godot_object _godot_object; /** */ PhysicsBody2D _GODOT_base; }
48 	alias _GODOT_base this;
49 	alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses);
50 	package(godot) __gshared bool _classBindingInitialized = false;
51 	package(godot) static struct GDNativeClassBinding
52 	{
53 		__gshared:
54 		@GodotName("_body_enter_tree") GodotMethod!(void, long) _bodyEnterTree;
55 		@GodotName("_body_exit_tree") GodotMethod!(void, long) _bodyExitTree;
56 		@GodotName("_direct_state_changed") GodotMethod!(void, GodotObject) _directStateChanged;
57 		@GodotName("_integrate_forces") GodotMethod!(void, Physics2DDirectBodyState) _integrateForces;
58 		@GodotName("_reload_physics_characteristics") GodotMethod!(void) _reloadPhysicsCharacteristics;
59 		@GodotName("add_central_force") GodotMethod!(void, Vector2) addCentralForce;
60 		@GodotName("add_force") GodotMethod!(void, Vector2, Vector2) addForce;
61 		@GodotName("add_torque") GodotMethod!(void, double) addTorque;
62 		@GodotName("apply_central_impulse") GodotMethod!(void, Vector2) applyCentralImpulse;
63 		@GodotName("apply_impulse") GodotMethod!(void, Vector2, Vector2) applyImpulse;
64 		@GodotName("apply_torque_impulse") GodotMethod!(void, double) applyTorqueImpulse;
65 		@GodotName("get_angular_damp") GodotMethod!(double) getAngularDamp;
66 		@GodotName("get_angular_velocity") GodotMethod!(double) getAngularVelocity;
67 		@GodotName("get_applied_force") GodotMethod!(Vector2) getAppliedForce;
68 		@GodotName("get_applied_torque") GodotMethod!(double) getAppliedTorque;
69 		@GodotName("get_bounce") GodotMethod!(double) getBounce;
70 		@GodotName("get_colliding_bodies") GodotMethod!(Array) getCollidingBodies;
71 		@GodotName("get_continuous_collision_detection_mode") GodotMethod!(RigidBody2D.CCDMode) getContinuousCollisionDetectionMode;
72 		@GodotName("get_friction") GodotMethod!(double) getFriction;
73 		@GodotName("get_gravity_scale") GodotMethod!(double) getGravityScale;
74 		@GodotName("get_inertia") GodotMethod!(double) getInertia;
75 		@GodotName("get_linear_damp") GodotMethod!(double) getLinearDamp;
76 		@GodotName("get_linear_velocity") GodotMethod!(Vector2) getLinearVelocity;
77 		@GodotName("get_mass") GodotMethod!(double) getMass;
78 		@GodotName("get_max_contacts_reported") GodotMethod!(long) getMaxContactsReported;
79 		@GodotName("get_mode") GodotMethod!(RigidBody2D.Mode) getMode;
80 		@GodotName("get_physics_material_override") GodotMethod!(PhysicsMaterial) getPhysicsMaterialOverride;
81 		@GodotName("get_weight") GodotMethod!(double) getWeight;
82 		@GodotName("is_able_to_sleep") GodotMethod!(bool) isAbleToSleep;
83 		@GodotName("is_contact_monitor_enabled") GodotMethod!(bool) isContactMonitorEnabled;
84 		@GodotName("is_sleeping") GodotMethod!(bool) isSleeping;
85 		@GodotName("is_using_custom_integrator") GodotMethod!(bool) isUsingCustomIntegrator;
86 		@GodotName("set_angular_damp") GodotMethod!(void, double) setAngularDamp;
87 		@GodotName("set_angular_velocity") GodotMethod!(void, double) setAngularVelocity;
88 		@GodotName("set_applied_force") GodotMethod!(void, Vector2) setAppliedForce;
89 		@GodotName("set_applied_torque") GodotMethod!(void, double) setAppliedTorque;
90 		@GodotName("set_axis_velocity") GodotMethod!(void, Vector2) setAxisVelocity;
91 		@GodotName("set_bounce") GodotMethod!(void, double) setBounce;
92 		@GodotName("set_can_sleep") GodotMethod!(void, bool) setCanSleep;
93 		@GodotName("set_contact_monitor") GodotMethod!(void, bool) setContactMonitor;
94 		@GodotName("set_continuous_collision_detection_mode") GodotMethod!(void, long) setContinuousCollisionDetectionMode;
95 		@GodotName("set_friction") GodotMethod!(void, double) setFriction;
96 		@GodotName("set_gravity_scale") GodotMethod!(void, double) setGravityScale;
97 		@GodotName("set_inertia") GodotMethod!(void, double) setInertia;
98 		@GodotName("set_linear_damp") GodotMethod!(void, double) setLinearDamp;
99 		@GodotName("set_linear_velocity") GodotMethod!(void, Vector2) setLinearVelocity;
100 		@GodotName("set_mass") GodotMethod!(void, double) setMass;
101 		@GodotName("set_max_contacts_reported") GodotMethod!(void, long) setMaxContactsReported;
102 		@GodotName("set_mode") GodotMethod!(void, long) setMode;
103 		@GodotName("set_physics_material_override") GodotMethod!(void, PhysicsMaterial) setPhysicsMaterialOverride;
104 		@GodotName("set_sleeping") GodotMethod!(void, bool) setSleeping;
105 		@GodotName("set_use_custom_integrator") GodotMethod!(void, bool) setUseCustomIntegrator;
106 		@GodotName("set_weight") GodotMethod!(void, double) setWeight;
107 		@GodotName("test_motion") GodotMethod!(bool, Vector2, bool, double, Physics2DTestMotionResult) testMotion;
108 	}
109 	/// 
110 	pragma(inline, true) bool opEquals(in RigidBody2D other) const
111 	{ return _godot_object.ptr is other._godot_object.ptr; }
112 	/// 
113 	pragma(inline, true) typeof(null) opAssign(typeof(null) n)
114 	{ _godot_object.ptr = n; return null; }
115 	/// 
116 	pragma(inline, true) bool opEquals(typeof(null) n) const
117 	{ return _godot_object.ptr is n; }
118 	/// 
119 	size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; }
120 	mixin baseCasts;
121 	/// Construct a new instance of RigidBody2D.
122 	/// Note: use `memnew!RigidBody2D` instead.
123 	static RigidBody2D _new()
124 	{
125 		static godot_class_constructor constructor;
126 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("RigidBody2D");
127 		if(constructor is null) return typeof(this).init;
128 		return cast(RigidBody2D)(constructor());
129 	}
130 	@disable new(size_t s);
131 	/// 
132 	enum Mode : int
133 	{
134 		/**
135 		Rigid mode. The body behaves as a physical object. It collides with other bodies and responds to forces applied to it. This is the default mode.
136 		*/
137 		modeRigid = 0,
138 		/**
139 		Static mode. The body behaves like a $(D StaticBody2D) and does not move.
140 		*/
141 		modeStatic = 1,
142 		/**
143 		Character mode. Similar to $(D constant MODE_RIGID), but the body can not rotate.
144 		*/
145 		modeCharacter = 2,
146 		/**
147 		Kinematic mode. The body behaves like a $(D KinematicBody2D), and must be moved by code.
148 		*/
149 		modeKinematic = 3,
150 	}
151 	/// 
152 	enum CCDMode : int
153 	{
154 		/**
155 		Continuous collision detection disabled. This is the fastest way to detect body collisions, but can miss small, fast-moving objects.
156 		*/
157 		ccdModeDisabled = 0,
158 		/**
159 		Continuous collision detection enabled using raycasting. This is faster than shapecasting but less precise.
160 		*/
161 		ccdModeCastRay = 1,
162 		/**
163 		Continuous collision detection enabled using shapecasting. This is the slowest CCD method and the most precise.
164 		*/
165 		ccdModeCastShape = 2,
166 	}
167 	/// 
168 	enum Constants : int
169 	{
170 		ccdModeDisabled = 0,
171 		modeRigid = 0,
172 		modeStatic = 1,
173 		ccdModeCastRay = 1,
174 		ccdModeCastShape = 2,
175 		modeCharacter = 2,
176 		modeKinematic = 3,
177 	}
178 	/**
179 	
180 	*/
181 	void _bodyEnterTree(in long arg0)
182 	{
183 		Array _GODOT_args = Array.make();
184 		_GODOT_args.append(arg0);
185 		String _GODOT_method_name = String("_body_enter_tree");
186 		this.callv(_GODOT_method_name, _GODOT_args);
187 	}
188 	/**
189 	
190 	*/
191 	void _bodyExitTree(in long arg0)
192 	{
193 		Array _GODOT_args = Array.make();
194 		_GODOT_args.append(arg0);
195 		String _GODOT_method_name = String("_body_exit_tree");
196 		this.callv(_GODOT_method_name, _GODOT_args);
197 	}
198 	/**
199 	
200 	*/
201 	void _directStateChanged(GodotObject arg0)
202 	{
203 		Array _GODOT_args = Array.make();
204 		_GODOT_args.append(arg0);
205 		String _GODOT_method_name = String("_direct_state_changed");
206 		this.callv(_GODOT_method_name, _GODOT_args);
207 	}
208 	/**
209 	Allows you to read and safely modify the simulation state for the object. Use this instead of $(D Node._physicsProcess) if you need to directly change the body's `position` or other physics properties. By default, it works in addition to the usual physics behavior, but $(D customIntegrator) allows you to disable the default behavior and write custom force integration for a body.
210 	*/
211 	void _integrateForces(Physics2DDirectBodyState state)
212 	{
213 		Array _GODOT_args = Array.make();
214 		_GODOT_args.append(state);
215 		String _GODOT_method_name = String("_integrate_forces");
216 		this.callv(_GODOT_method_name, _GODOT_args);
217 	}
218 	/**
219 	
220 	*/
221 	void _reloadPhysicsCharacteristics()
222 	{
223 		Array _GODOT_args = Array.make();
224 		String _GODOT_method_name = String("_reload_physics_characteristics");
225 		this.callv(_GODOT_method_name, _GODOT_args);
226 	}
227 	/**
228 	Adds a constant directional force without affecting rotation.
229 	*/
230 	void addCentralForce(in Vector2 force)
231 	{
232 		checkClassBinding!(typeof(this))();
233 		ptrcall!(void)(GDNativeClassBinding.addCentralForce, _godot_object, force);
234 	}
235 	/**
236 	Adds a positioned force to the body. Both the force and the offset from the body origin are in global coordinates.
237 	*/
238 	void addForce(in Vector2 offset, in Vector2 force)
239 	{
240 		checkClassBinding!(typeof(this))();
241 		ptrcall!(void)(GDNativeClassBinding.addForce, _godot_object, offset, force);
242 	}
243 	/**
244 	Adds a constant rotational force.
245 	*/
246 	void addTorque(in double torque)
247 	{
248 		checkClassBinding!(typeof(this))();
249 		ptrcall!(void)(GDNativeClassBinding.addTorque, _godot_object, torque);
250 	}
251 	/**
252 	Applies a directional impulse without affecting rotation.
253 	*/
254 	void applyCentralImpulse(in Vector2 impulse)
255 	{
256 		checkClassBinding!(typeof(this))();
257 		ptrcall!(void)(GDNativeClassBinding.applyCentralImpulse, _godot_object, impulse);
258 	}
259 	/**
260 	Applies a positioned impulse to the body. An impulse is time-independent! Applying an impulse every frame would result in a framerate-dependent force. For this reason it should only be used when simulating one-time impacts (use the "_force" functions otherwise). The position uses the rotation of the global coordinate system, but is centered at the object's origin.
261 	*/
262 	void applyImpulse(in Vector2 offset, in Vector2 impulse)
263 	{
264 		checkClassBinding!(typeof(this))();
265 		ptrcall!(void)(GDNativeClassBinding.applyImpulse, _godot_object, offset, impulse);
266 	}
267 	/**
268 	Applies a rotational impulse to the body.
269 	*/
270 	void applyTorqueImpulse(in double torque)
271 	{
272 		checkClassBinding!(typeof(this))();
273 		ptrcall!(void)(GDNativeClassBinding.applyTorqueImpulse, _godot_object, torque);
274 	}
275 	/**
276 	
277 	*/
278 	double getAngularDamp() const
279 	{
280 		checkClassBinding!(typeof(this))();
281 		return ptrcall!(double)(GDNativeClassBinding.getAngularDamp, _godot_object);
282 	}
283 	/**
284 	
285 	*/
286 	double getAngularVelocity() const
287 	{
288 		checkClassBinding!(typeof(this))();
289 		return ptrcall!(double)(GDNativeClassBinding.getAngularVelocity, _godot_object);
290 	}
291 	/**
292 	
293 	*/
294 	Vector2 getAppliedForce() const
295 	{
296 		checkClassBinding!(typeof(this))();
297 		return ptrcall!(Vector2)(GDNativeClassBinding.getAppliedForce, _godot_object);
298 	}
299 	/**
300 	
301 	*/
302 	double getAppliedTorque() const
303 	{
304 		checkClassBinding!(typeof(this))();
305 		return ptrcall!(double)(GDNativeClassBinding.getAppliedTorque, _godot_object);
306 	}
307 	/**
308 	
309 	*/
310 	double getBounce() const
311 	{
312 		checkClassBinding!(typeof(this))();
313 		return ptrcall!(double)(GDNativeClassBinding.getBounce, _godot_object);
314 	}
315 	/**
316 	Returns a list of the bodies colliding with this one. Requires $(D contactMonitor) to be set to `true` and $(D contactsReported) to be set high enough to detect all the collisions.
317 	$(B Note:) The result of this test is not immediate after moving objects. For performance, list of collisions is updated once per frame and before the physics step. Consider using signals instead.
318 	*/
319 	Array getCollidingBodies() const
320 	{
321 		checkClassBinding!(typeof(this))();
322 		return ptrcall!(Array)(GDNativeClassBinding.getCollidingBodies, _godot_object);
323 	}
324 	/**
325 	
326 	*/
327 	RigidBody2D.CCDMode getContinuousCollisionDetectionMode() const
328 	{
329 		checkClassBinding!(typeof(this))();
330 		return ptrcall!(RigidBody2D.CCDMode)(GDNativeClassBinding.getContinuousCollisionDetectionMode, _godot_object);
331 	}
332 	/**
333 	
334 	*/
335 	double getFriction() const
336 	{
337 		checkClassBinding!(typeof(this))();
338 		return ptrcall!(double)(GDNativeClassBinding.getFriction, _godot_object);
339 	}
340 	/**
341 	
342 	*/
343 	double getGravityScale() const
344 	{
345 		checkClassBinding!(typeof(this))();
346 		return ptrcall!(double)(GDNativeClassBinding.getGravityScale, _godot_object);
347 	}
348 	/**
349 	
350 	*/
351 	double getInertia() const
352 	{
353 		checkClassBinding!(typeof(this))();
354 		return ptrcall!(double)(GDNativeClassBinding.getInertia, _godot_object);
355 	}
356 	/**
357 	
358 	*/
359 	double getLinearDamp() const
360 	{
361 		checkClassBinding!(typeof(this))();
362 		return ptrcall!(double)(GDNativeClassBinding.getLinearDamp, _godot_object);
363 	}
364 	/**
365 	
366 	*/
367 	Vector2 getLinearVelocity() const
368 	{
369 		checkClassBinding!(typeof(this))();
370 		return ptrcall!(Vector2)(GDNativeClassBinding.getLinearVelocity, _godot_object);
371 	}
372 	/**
373 	
374 	*/
375 	double getMass() const
376 	{
377 		checkClassBinding!(typeof(this))();
378 		return ptrcall!(double)(GDNativeClassBinding.getMass, _godot_object);
379 	}
380 	/**
381 	
382 	*/
383 	long getMaxContactsReported() const
384 	{
385 		checkClassBinding!(typeof(this))();
386 		return ptrcall!(long)(GDNativeClassBinding.getMaxContactsReported, _godot_object);
387 	}
388 	/**
389 	
390 	*/
391 	RigidBody2D.Mode getMode() const
392 	{
393 		checkClassBinding!(typeof(this))();
394 		return ptrcall!(RigidBody2D.Mode)(GDNativeClassBinding.getMode, _godot_object);
395 	}
396 	/**
397 	
398 	*/
399 	Ref!PhysicsMaterial getPhysicsMaterialOverride() const
400 	{
401 		checkClassBinding!(typeof(this))();
402 		return ptrcall!(PhysicsMaterial)(GDNativeClassBinding.getPhysicsMaterialOverride, _godot_object);
403 	}
404 	/**
405 	
406 	*/
407 	double getWeight() const
408 	{
409 		checkClassBinding!(typeof(this))();
410 		return ptrcall!(double)(GDNativeClassBinding.getWeight, _godot_object);
411 	}
412 	/**
413 	
414 	*/
415 	bool isAbleToSleep() const
416 	{
417 		checkClassBinding!(typeof(this))();
418 		return ptrcall!(bool)(GDNativeClassBinding.isAbleToSleep, _godot_object);
419 	}
420 	/**
421 	
422 	*/
423 	bool isContactMonitorEnabled() const
424 	{
425 		checkClassBinding!(typeof(this))();
426 		return ptrcall!(bool)(GDNativeClassBinding.isContactMonitorEnabled, _godot_object);
427 	}
428 	/**
429 	
430 	*/
431 	bool isSleeping() const
432 	{
433 		checkClassBinding!(typeof(this))();
434 		return ptrcall!(bool)(GDNativeClassBinding.isSleeping, _godot_object);
435 	}
436 	/**
437 	
438 	*/
439 	bool isUsingCustomIntegrator()
440 	{
441 		checkClassBinding!(typeof(this))();
442 		return ptrcall!(bool)(GDNativeClassBinding.isUsingCustomIntegrator, _godot_object);
443 	}
444 	/**
445 	
446 	*/
447 	void setAngularDamp(in double angular_damp)
448 	{
449 		checkClassBinding!(typeof(this))();
450 		ptrcall!(void)(GDNativeClassBinding.setAngularDamp, _godot_object, angular_damp);
451 	}
452 	/**
453 	
454 	*/
455 	void setAngularVelocity(in double angular_velocity)
456 	{
457 		checkClassBinding!(typeof(this))();
458 		ptrcall!(void)(GDNativeClassBinding.setAngularVelocity, _godot_object, angular_velocity);
459 	}
460 	/**
461 	
462 	*/
463 	void setAppliedForce(in Vector2 force)
464 	{
465 		checkClassBinding!(typeof(this))();
466 		ptrcall!(void)(GDNativeClassBinding.setAppliedForce, _godot_object, force);
467 	}
468 	/**
469 	
470 	*/
471 	void setAppliedTorque(in double torque)
472 	{
473 		checkClassBinding!(typeof(this))();
474 		ptrcall!(void)(GDNativeClassBinding.setAppliedTorque, _godot_object, torque);
475 	}
476 	/**
477 	Sets the body's velocity on the given axis. The velocity in the given vector axis will be set as the given vector length. This is useful for jumping behavior.
478 	*/
479 	void setAxisVelocity(in Vector2 axis_velocity)
480 	{
481 		checkClassBinding!(typeof(this))();
482 		ptrcall!(void)(GDNativeClassBinding.setAxisVelocity, _godot_object, axis_velocity);
483 	}
484 	/**
485 	
486 	*/
487 	void setBounce(in double bounce)
488 	{
489 		checkClassBinding!(typeof(this))();
490 		ptrcall!(void)(GDNativeClassBinding.setBounce, _godot_object, bounce);
491 	}
492 	/**
493 	
494 	*/
495 	void setCanSleep(in bool able_to_sleep)
496 	{
497 		checkClassBinding!(typeof(this))();
498 		ptrcall!(void)(GDNativeClassBinding.setCanSleep, _godot_object, able_to_sleep);
499 	}
500 	/**
501 	
502 	*/
503 	void setContactMonitor(in bool enabled)
504 	{
505 		checkClassBinding!(typeof(this))();
506 		ptrcall!(void)(GDNativeClassBinding.setContactMonitor, _godot_object, enabled);
507 	}
508 	/**
509 	
510 	*/
511 	void setContinuousCollisionDetectionMode(in long mode)
512 	{
513 		checkClassBinding!(typeof(this))();
514 		ptrcall!(void)(GDNativeClassBinding.setContinuousCollisionDetectionMode, _godot_object, mode);
515 	}
516 	/**
517 	
518 	*/
519 	void setFriction(in double friction)
520 	{
521 		checkClassBinding!(typeof(this))();
522 		ptrcall!(void)(GDNativeClassBinding.setFriction, _godot_object, friction);
523 	}
524 	/**
525 	
526 	*/
527 	void setGravityScale(in double gravity_scale)
528 	{
529 		checkClassBinding!(typeof(this))();
530 		ptrcall!(void)(GDNativeClassBinding.setGravityScale, _godot_object, gravity_scale);
531 	}
532 	/**
533 	
534 	*/
535 	void setInertia(in double inertia)
536 	{
537 		checkClassBinding!(typeof(this))();
538 		ptrcall!(void)(GDNativeClassBinding.setInertia, _godot_object, inertia);
539 	}
540 	/**
541 	
542 	*/
543 	void setLinearDamp(in double linear_damp)
544 	{
545 		checkClassBinding!(typeof(this))();
546 		ptrcall!(void)(GDNativeClassBinding.setLinearDamp, _godot_object, linear_damp);
547 	}
548 	/**
549 	
550 	*/
551 	void setLinearVelocity(in Vector2 linear_velocity)
552 	{
553 		checkClassBinding!(typeof(this))();
554 		ptrcall!(void)(GDNativeClassBinding.setLinearVelocity, _godot_object, linear_velocity);
555 	}
556 	/**
557 	
558 	*/
559 	void setMass(in double mass)
560 	{
561 		checkClassBinding!(typeof(this))();
562 		ptrcall!(void)(GDNativeClassBinding.setMass, _godot_object, mass);
563 	}
564 	/**
565 	
566 	*/
567 	void setMaxContactsReported(in long amount)
568 	{
569 		checkClassBinding!(typeof(this))();
570 		ptrcall!(void)(GDNativeClassBinding.setMaxContactsReported, _godot_object, amount);
571 	}
572 	/**
573 	
574 	*/
575 	void setMode(in long mode)
576 	{
577 		checkClassBinding!(typeof(this))();
578 		ptrcall!(void)(GDNativeClassBinding.setMode, _godot_object, mode);
579 	}
580 	/**
581 	
582 	*/
583 	void setPhysicsMaterialOverride(PhysicsMaterial physics_material_override)
584 	{
585 		checkClassBinding!(typeof(this))();
586 		ptrcall!(void)(GDNativeClassBinding.setPhysicsMaterialOverride, _godot_object, physics_material_override);
587 	}
588 	/**
589 	
590 	*/
591 	void setSleeping(in bool sleeping)
592 	{
593 		checkClassBinding!(typeof(this))();
594 		ptrcall!(void)(GDNativeClassBinding.setSleeping, _godot_object, sleeping);
595 	}
596 	/**
597 	
598 	*/
599 	void setUseCustomIntegrator(in bool enable)
600 	{
601 		checkClassBinding!(typeof(this))();
602 		ptrcall!(void)(GDNativeClassBinding.setUseCustomIntegrator, _godot_object, enable);
603 	}
604 	/**
605 	
606 	*/
607 	void setWeight(in double weight)
608 	{
609 		checkClassBinding!(typeof(this))();
610 		ptrcall!(void)(GDNativeClassBinding.setWeight, _godot_object, weight);
611 	}
612 	/**
613 	Returns `true` if a collision would result from moving in the given vector. `margin` increases the size of the shapes involved in the collision detection, and `result` is an object of type $(D Physics2DTestMotionResult), which contains additional information about the collision (should there be one).
614 	*/
615 	bool testMotion(in Vector2 motion, in bool infinite_inertia = true, in double margin = 0.08, Physics2DTestMotionResult result = Physics2DTestMotionResult.init)
616 	{
617 		checkClassBinding!(typeof(this))();
618 		return ptrcall!(bool)(GDNativeClassBinding.testMotion, _godot_object, motion, infinite_inertia, margin, result);
619 	}
620 	/**
621 	Damps the body's $(D angularVelocity). If `-1`, the body will use the $(B Default Angular Damp) defined in $(B Project > Project Settings > Physics > 2d).
622 	See $(D ProjectSettings.physics/2d/defaultAngularDamp) for more details about damping.
623 	*/
624 	@property double angularDamp()
625 	{
626 		return getAngularDamp();
627 	}
628 	/// ditto
629 	@property void angularDamp(double v)
630 	{
631 		setAngularDamp(v);
632 	}
633 	/**
634 	The body's rotational velocity.
635 	*/
636 	@property double angularVelocity()
637 	{
638 		return getAngularVelocity();
639 	}
640 	/// ditto
641 	@property void angularVelocity(double v)
642 	{
643 		setAngularVelocity(v);
644 	}
645 	/**
646 	The body's total applied force.
647 	*/
648 	@property Vector2 appliedForce()
649 	{
650 		return getAppliedForce();
651 	}
652 	/// ditto
653 	@property void appliedForce(Vector2 v)
654 	{
655 		setAppliedForce(v);
656 	}
657 	/**
658 	The body's total applied torque.
659 	*/
660 	@property double appliedTorque()
661 	{
662 		return getAppliedTorque();
663 	}
664 	/// ditto
665 	@property void appliedTorque(double v)
666 	{
667 		setAppliedTorque(v);
668 	}
669 	/**
670 	The body's bounciness. Values range from `0` (no bounce) to `1` (full bounciness).
671 	Deprecated, use $(D PhysicsMaterial.bounce) instead via $(D physicsMaterialOverride).
672 	*/
673 	@property double bounce()
674 	{
675 		return getBounce();
676 	}
677 	/// ditto
678 	@property void bounce(double v)
679 	{
680 		setBounce(v);
681 	}
682 	/**
683 	If `true`, the body can enter sleep mode when there is no movement. See $(D sleeping).
684 	$(B Note:) A RigidBody2D will never enter sleep mode automatically if its $(D mode) is $(D constant MODE_CHARACTER). It can still be put to sleep manually by setting its $(D sleeping) property to `true`.
685 	*/
686 	@property bool canSleep()
687 	{
688 		return isAbleToSleep();
689 	}
690 	/// ditto
691 	@property void canSleep(bool v)
692 	{
693 		setCanSleep(v);
694 	}
695 	/**
696 	If `true`, the body will emit signals when it collides with another RigidBody2D. See also $(D contactsReported).
697 	*/
698 	@property bool contactMonitor()
699 	{
700 		return isContactMonitorEnabled();
701 	}
702 	/// ditto
703 	@property void contactMonitor(bool v)
704 	{
705 		setContactMonitor(v);
706 	}
707 	/**
708 	The maximum number of contacts that will be recorded. Requires $(D contactMonitor) to be set to `true`.
709 	$(B Note:) The number of contacts is different from the number of collisions. Collisions between parallel edges will result in two contacts (one at each end).
710 	*/
711 	@property long contactsReported()
712 	{
713 		return getMaxContactsReported();
714 	}
715 	/// ditto
716 	@property void contactsReported(long v)
717 	{
718 		setMaxContactsReported(v);
719 	}
720 	/**
721 	Continuous collision detection mode.
722 	Continuous collision detection tries to predict where a moving body will collide instead of moving it and correcting its movement after collision. Continuous collision detection is slower, but more precise and misses fewer collisions with small, fast-moving objects. Raycasting and shapecasting methods are available. See $(D ccdmode) for details.
723 	*/
724 	@property RigidBody2D.CCDMode continuousCd()
725 	{
726 		return getContinuousCollisionDetectionMode();
727 	}
728 	/// ditto
729 	@property void continuousCd(long v)
730 	{
731 		setContinuousCollisionDetectionMode(v);
732 	}
733 	/**
734 	If `true`, internal force integration is disabled for this body. Aside from collision response, the body will only move as determined by the $(D _integrateForces) function.
735 	*/
736 	@property bool customIntegrator()
737 	{
738 		return isUsingCustomIntegrator();
739 	}
740 	/// ditto
741 	@property void customIntegrator(bool v)
742 	{
743 		setUseCustomIntegrator(v);
744 	}
745 	/**
746 	The body's friction. Values range from `0` (frictionless) to `1` (maximum friction).
747 	Deprecated, use $(D PhysicsMaterial.friction) instead via $(D physicsMaterialOverride).
748 	*/
749 	@property double friction()
750 	{
751 		return getFriction();
752 	}
753 	/// ditto
754 	@property void friction(double v)
755 	{
756 		setFriction(v);
757 	}
758 	/**
759 	Multiplies the gravity applied to the body. The body's gravity is calculated from the $(B Default Gravity) value in $(B Project > Project Settings > Physics > 2d) and/or any additional gravity vector applied by $(D Area2D)s.
760 	*/
761 	@property double gravityScale()
762 	{
763 		return getGravityScale();
764 	}
765 	/// ditto
766 	@property void gravityScale(double v)
767 	{
768 		setGravityScale(v);
769 	}
770 	/**
771 	The body's moment of inertia. This is like mass, but for rotation: it determines how much torque it takes to rotate the body. The moment of inertia is usually computed automatically from the mass and the shapes, but this function allows you to set a custom value. Set 0 inertia to return to automatically computing it.
772 	*/
773 	@property double inertia()
774 	{
775 		return getInertia();
776 	}
777 	/// ditto
778 	@property void inertia(double v)
779 	{
780 		setInertia(v);
781 	}
782 	/**
783 	Damps the body's $(D linearVelocity). If `-1`, the body will use the $(B Default Linear Damp) in $(B Project > Project Settings > Physics > 2d).
784 	See $(D ProjectSettings.physics/2d/defaultLinearDamp) for more details about damping.
785 	*/
786 	@property double linearDamp()
787 	{
788 		return getLinearDamp();
789 	}
790 	/// ditto
791 	@property void linearDamp(double v)
792 	{
793 		setLinearDamp(v);
794 	}
795 	/**
796 	The body's linear velocity.
797 	*/
798 	@property Vector2 linearVelocity()
799 	{
800 		return getLinearVelocity();
801 	}
802 	/// ditto
803 	@property void linearVelocity(Vector2 v)
804 	{
805 		setLinearVelocity(v);
806 	}
807 	/**
808 	The body's mass.
809 	*/
810 	@property double mass()
811 	{
812 		return getMass();
813 	}
814 	/// ditto
815 	@property void mass(double v)
816 	{
817 		setMass(v);
818 	}
819 	/**
820 	The body's mode. See $(D mode) for possible values.
821 	*/
822 	@property RigidBody2D.Mode mode()
823 	{
824 		return getMode();
825 	}
826 	/// ditto
827 	@property void mode(long v)
828 	{
829 		setMode(v);
830 	}
831 	/**
832 	The physics material override for the body.
833 	If a material is assigned to this property, it will be used instead of any other physics material, such as an inherited one.
834 	*/
835 	@property PhysicsMaterial physicsMaterialOverride()
836 	{
837 		return getPhysicsMaterialOverride();
838 	}
839 	/// ditto
840 	@property void physicsMaterialOverride(PhysicsMaterial v)
841 	{
842 		setPhysicsMaterialOverride(v);
843 	}
844 	/**
845 	If `true`, the body will not move and will not calculate forces until woken up by another body through, for example, a collision, or by using the $(D applyImpulse) or $(D addForce) methods.
846 	*/
847 	@property bool sleeping()
848 	{
849 		return isSleeping();
850 	}
851 	/// ditto
852 	@property void sleeping(bool v)
853 	{
854 		setSleeping(v);
855 	}
856 	/**
857 	The body's weight based on its mass and the $(B Default Gravity) value in $(B Project > Project Settings > Physics > 2d).
858 	*/
859 	@property double weight()
860 	{
861 		return getWeight();
862 	}
863 	/// ditto
864 	@property void weight(double v)
865 	{
866 		setWeight(v);
867 	}
868 }