1 /**
2 Physics Body whose position is determined through physics simulation in 3D space.
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.rigidbody;
14 import std.meta : AliasSeq, staticIndexOf;
15 import std.traits : Unqual;
16 import godot.d.traits;
17 import godot.core;
18 import godot.c;
19 import godot.d.bind;
20 import godot.d.reference;
21 import godot.globalenums;
22 import godot.object;
23 import godot.classdb;
24 import godot.physicsbody;
25 import godot.collisionobject;
26 import godot.spatial;
27 import godot.physicsdirectbodystate;
28 import godot.physicsmaterial;
29 /**
30 Physics Body whose position is determined through physics simulation in 3D space.
31 
32 This is the node that implements full 3D physics. This means that you do not control a RigidBody directly. Instead, you can apply forces to it (gravity, impulses, etc.), and the physics simulation will calculate the resulting movement, collision, bouncing, rotating, etc.
33 A RigidBody has 4 behavior $(D mode)s: Rigid, Static, Character, and Kinematic.
34 $(B Note:) Don't change a RigidBody's position every frame or very often. Sporadic changes work fine, but physics runs at a different granularity (fixed Hz) than usual rendering (process callback) and maybe even in a separate thread, so changing this from a process loop may result in strange behavior. If you need to directly affect the body's state, use $(D _integrateForces), which allows you to directly access the physics state.
35 If you need to override the default physics behavior, you can write a custom force integration function. See $(D customIntegrator).
36 With Bullet physics (the default), the center of mass is the RigidBody3D center. With GodotPhysics, the center of mass is the average of the $(D CollisionShape) centers.
37 */
38 @GodotBaseClass struct RigidBody
39 {
40 	package(godot) enum string _GODOT_internal_name = "RigidBody";
41 public:
42 @nogc nothrow:
43 	union { /** */ godot_object _godot_object; /** */ PhysicsBody _GODOT_base; }
44 	alias _GODOT_base this;
45 	alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses);
46 	package(godot) __gshared bool _classBindingInitialized = false;
47 	package(godot) static struct GDNativeClassBinding
48 	{
49 		__gshared:
50 		@GodotName("_body_enter_tree") GodotMethod!(void, long) _bodyEnterTree;
51 		@GodotName("_body_exit_tree") GodotMethod!(void, long) _bodyExitTree;
52 		@GodotName("_direct_state_changed") GodotMethod!(void, GodotObject) _directStateChanged;
53 		@GodotName("_integrate_forces") GodotMethod!(void, PhysicsDirectBodyState) _integrateForces;
54 		@GodotName("_reload_physics_characteristics") GodotMethod!(void) _reloadPhysicsCharacteristics;
55 		@GodotName("add_central_force") GodotMethod!(void, Vector3) addCentralForce;
56 		@GodotName("add_force") GodotMethod!(void, Vector3, Vector3) addForce;
57 		@GodotName("add_torque") GodotMethod!(void, Vector3) addTorque;
58 		@GodotName("apply_central_impulse") GodotMethod!(void, Vector3) applyCentralImpulse;
59 		@GodotName("apply_impulse") GodotMethod!(void, Vector3, Vector3) applyImpulse;
60 		@GodotName("apply_torque_impulse") GodotMethod!(void, Vector3) applyTorqueImpulse;
61 		@GodotName("get_angular_damp") GodotMethod!(double) getAngularDamp;
62 		@GodotName("get_angular_velocity") GodotMethod!(Vector3) getAngularVelocity;
63 		@GodotName("get_axis_lock") GodotMethod!(bool, long) getAxisLock;
64 		@GodotName("get_bounce") GodotMethod!(double) getBounce;
65 		@GodotName("get_colliding_bodies") GodotMethod!(Array) getCollidingBodies;
66 		@GodotName("get_friction") GodotMethod!(double) getFriction;
67 		@GodotName("get_gravity_scale") GodotMethod!(double) getGravityScale;
68 		@GodotName("get_inverse_inertia_tensor") GodotMethod!(Basis) getInverseInertiaTensor;
69 		@GodotName("get_linear_damp") GodotMethod!(double) getLinearDamp;
70 		@GodotName("get_linear_velocity") GodotMethod!(Vector3) getLinearVelocity;
71 		@GodotName("get_mass") GodotMethod!(double) getMass;
72 		@GodotName("get_max_contacts_reported") GodotMethod!(long) getMaxContactsReported;
73 		@GodotName("get_mode") GodotMethod!(RigidBody.Mode) getMode;
74 		@GodotName("get_physics_material_override") GodotMethod!(PhysicsMaterial) getPhysicsMaterialOverride;
75 		@GodotName("get_weight") GodotMethod!(double) getWeight;
76 		@GodotName("is_able_to_sleep") GodotMethod!(bool) isAbleToSleep;
77 		@GodotName("is_contact_monitor_enabled") GodotMethod!(bool) isContactMonitorEnabled;
78 		@GodotName("is_sleeping") GodotMethod!(bool) isSleeping;
79 		@GodotName("is_using_continuous_collision_detection") GodotMethod!(bool) isUsingContinuousCollisionDetection;
80 		@GodotName("is_using_custom_integrator") GodotMethod!(bool) isUsingCustomIntegrator;
81 		@GodotName("set_angular_damp") GodotMethod!(void, double) setAngularDamp;
82 		@GodotName("set_angular_velocity") GodotMethod!(void, Vector3) setAngularVelocity;
83 		@GodotName("set_axis_lock") GodotMethod!(void, long, bool) setAxisLock;
84 		@GodotName("set_axis_velocity") GodotMethod!(void, Vector3) setAxisVelocity;
85 		@GodotName("set_bounce") GodotMethod!(void, double) setBounce;
86 		@GodotName("set_can_sleep") GodotMethod!(void, bool) setCanSleep;
87 		@GodotName("set_contact_monitor") GodotMethod!(void, bool) setContactMonitor;
88 		@GodotName("set_friction") GodotMethod!(void, double) setFriction;
89 		@GodotName("set_gravity_scale") GodotMethod!(void, double) setGravityScale;
90 		@GodotName("set_linear_damp") GodotMethod!(void, double) setLinearDamp;
91 		@GodotName("set_linear_velocity") GodotMethod!(void, Vector3) setLinearVelocity;
92 		@GodotName("set_mass") GodotMethod!(void, double) setMass;
93 		@GodotName("set_max_contacts_reported") GodotMethod!(void, long) setMaxContactsReported;
94 		@GodotName("set_mode") GodotMethod!(void, long) setMode;
95 		@GodotName("set_physics_material_override") GodotMethod!(void, PhysicsMaterial) setPhysicsMaterialOverride;
96 		@GodotName("set_sleeping") GodotMethod!(void, bool) setSleeping;
97 		@GodotName("set_use_continuous_collision_detection") GodotMethod!(void, bool) setUseContinuousCollisionDetection;
98 		@GodotName("set_use_custom_integrator") GodotMethod!(void, bool) setUseCustomIntegrator;
99 		@GodotName("set_weight") GodotMethod!(void, double) setWeight;
100 	}
101 	/// 
102 	pragma(inline, true) bool opEquals(in RigidBody other) const
103 	{ return _godot_object.ptr is other._godot_object.ptr; }
104 	/// 
105 	pragma(inline, true) typeof(null) opAssign(typeof(null) n)
106 	{ _godot_object.ptr = n; return null; }
107 	/// 
108 	pragma(inline, true) bool opEquals(typeof(null) n) const
109 	{ return _godot_object.ptr is n; }
110 	/// 
111 	size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; }
112 	mixin baseCasts;
113 	/// Construct a new instance of RigidBody.
114 	/// Note: use `memnew!RigidBody` instead.
115 	static RigidBody _new()
116 	{
117 		static godot_class_constructor constructor;
118 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("RigidBody");
119 		if(constructor is null) return typeof(this).init;
120 		return cast(RigidBody)(constructor());
121 	}
122 	@disable new(size_t s);
123 	/// 
124 	enum Mode : int
125 	{
126 		/**
127 		Rigid body mode. This is the "natural" state of a rigid body. It is affected by forces, and can move, rotate, and be affected by user code.
128 		*/
129 		modeRigid = 0,
130 		/**
131 		Static mode. The body behaves like a $(D StaticBody), and can only move by user code.
132 		*/
133 		modeStatic = 1,
134 		/**
135 		Character body mode. This behaves like a rigid body, but can not rotate.
136 		*/
137 		modeCharacter = 2,
138 		/**
139 		Kinematic body mode. The body behaves like a $(D KinematicBody), and can only move by user code.
140 		*/
141 		modeKinematic = 3,
142 	}
143 	/// 
144 	enum Constants : int
145 	{
146 		modeRigid = 0,
147 		modeStatic = 1,
148 		modeCharacter = 2,
149 		modeKinematic = 3,
150 	}
151 	/**
152 	
153 	*/
154 	void _bodyEnterTree(in long arg0)
155 	{
156 		Array _GODOT_args = Array.make();
157 		_GODOT_args.append(arg0);
158 		String _GODOT_method_name = String("_body_enter_tree");
159 		this.callv(_GODOT_method_name, _GODOT_args);
160 	}
161 	/**
162 	
163 	*/
164 	void _bodyExitTree(in long arg0)
165 	{
166 		Array _GODOT_args = Array.make();
167 		_GODOT_args.append(arg0);
168 		String _GODOT_method_name = String("_body_exit_tree");
169 		this.callv(_GODOT_method_name, _GODOT_args);
170 	}
171 	/**
172 	
173 	*/
174 	void _directStateChanged(GodotObject arg0)
175 	{
176 		Array _GODOT_args = Array.make();
177 		_GODOT_args.append(arg0);
178 		String _GODOT_method_name = String("_direct_state_changed");
179 		this.callv(_GODOT_method_name, _GODOT_args);
180 	}
181 	/**
182 	Called during physics processing, allowing you to read and safely modify the simulation state for the object. By default, it works in addition to the usual physics behavior, but the $(D customIntegrator) property allows you to disable the default behavior and do fully custom force integration for a body.
183 	*/
184 	void _integrateForces(PhysicsDirectBodyState state)
185 	{
186 		Array _GODOT_args = Array.make();
187 		_GODOT_args.append(state);
188 		String _GODOT_method_name = String("_integrate_forces");
189 		this.callv(_GODOT_method_name, _GODOT_args);
190 	}
191 	/**
192 	
193 	*/
194 	void _reloadPhysicsCharacteristics()
195 	{
196 		Array _GODOT_args = Array.make();
197 		String _GODOT_method_name = String("_reload_physics_characteristics");
198 		this.callv(_GODOT_method_name, _GODOT_args);
199 	}
200 	/**
201 	Adds a constant directional force (i.e. acceleration) without affecting rotation.
202 	This is equivalent to `add_force(force, Vector3(0,0,0))`.
203 	*/
204 	void addCentralForce(in Vector3 force)
205 	{
206 		checkClassBinding!(typeof(this))();
207 		ptrcall!(void)(GDNativeClassBinding.addCentralForce, _godot_object, force);
208 	}
209 	/**
210 	Adds a constant directional force (i.e. acceleration).
211 	The position uses the rotation of the global coordinate system, but is centered at the object's origin.
212 	*/
213 	void addForce(in Vector3 force, in Vector3 position)
214 	{
215 		checkClassBinding!(typeof(this))();
216 		ptrcall!(void)(GDNativeClassBinding.addForce, _godot_object, force, position);
217 	}
218 	/**
219 	Adds a constant rotational force (i.e. a motor) without affecting position.
220 	*/
221 	void addTorque(in Vector3 torque)
222 	{
223 		checkClassBinding!(typeof(this))();
224 		ptrcall!(void)(GDNativeClassBinding.addTorque, _godot_object, torque);
225 	}
226 	/**
227 	Applies a directional impulse without affecting rotation.
228 	This is equivalent to `apply_impulse(Vector3(0,0,0), impulse)`.
229 	*/
230 	void applyCentralImpulse(in Vector3 impulse)
231 	{
232 		checkClassBinding!(typeof(this))();
233 		ptrcall!(void)(GDNativeClassBinding.applyCentralImpulse, _godot_object, impulse);
234 	}
235 	/**
236 	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. The position uses the rotation of the global coordinate system, but is centered at the object's origin.
237 	*/
238 	void applyImpulse(in Vector3 position, in Vector3 impulse)
239 	{
240 		checkClassBinding!(typeof(this))();
241 		ptrcall!(void)(GDNativeClassBinding.applyImpulse, _godot_object, position, impulse);
242 	}
243 	/**
244 	Applies a torque impulse which will be affected by the body mass and shape. This will rotate the body around the `impulse` vector passed.
245 	*/
246 	void applyTorqueImpulse(in Vector3 impulse)
247 	{
248 		checkClassBinding!(typeof(this))();
249 		ptrcall!(void)(GDNativeClassBinding.applyTorqueImpulse, _godot_object, impulse);
250 	}
251 	/**
252 	
253 	*/
254 	double getAngularDamp() const
255 	{
256 		checkClassBinding!(typeof(this))();
257 		return ptrcall!(double)(GDNativeClassBinding.getAngularDamp, _godot_object);
258 	}
259 	/**
260 	
261 	*/
262 	Vector3 getAngularVelocity() const
263 	{
264 		checkClassBinding!(typeof(this))();
265 		return ptrcall!(Vector3)(GDNativeClassBinding.getAngularVelocity, _godot_object);
266 	}
267 	/**
268 	Returns `true` if the specified linear or rotational axis is locked.
269 	*/
270 	bool getAxisLock(in long axis) const
271 	{
272 		checkClassBinding!(typeof(this))();
273 		return ptrcall!(bool)(GDNativeClassBinding.getAxisLock, _godot_object, axis);
274 	}
275 	/**
276 	
277 	*/
278 	double getBounce() const
279 	{
280 		checkClassBinding!(typeof(this))();
281 		return ptrcall!(double)(GDNativeClassBinding.getBounce, _godot_object);
282 	}
283 	/**
284 	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.
285 	$(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.
286 	*/
287 	Array getCollidingBodies() const
288 	{
289 		checkClassBinding!(typeof(this))();
290 		return ptrcall!(Array)(GDNativeClassBinding.getCollidingBodies, _godot_object);
291 	}
292 	/**
293 	
294 	*/
295 	double getFriction() const
296 	{
297 		checkClassBinding!(typeof(this))();
298 		return ptrcall!(double)(GDNativeClassBinding.getFriction, _godot_object);
299 	}
300 	/**
301 	
302 	*/
303 	double getGravityScale() const
304 	{
305 		checkClassBinding!(typeof(this))();
306 		return ptrcall!(double)(GDNativeClassBinding.getGravityScale, _godot_object);
307 	}
308 	/**
309 	Returns the inverse inertia tensor basis. This is used to calculate the angular acceleration resulting from a torque applied to the RigidBody.
310 	*/
311 	Basis getInverseInertiaTensor()
312 	{
313 		checkClassBinding!(typeof(this))();
314 		return ptrcall!(Basis)(GDNativeClassBinding.getInverseInertiaTensor, _godot_object);
315 	}
316 	/**
317 	
318 	*/
319 	double getLinearDamp() const
320 	{
321 		checkClassBinding!(typeof(this))();
322 		return ptrcall!(double)(GDNativeClassBinding.getLinearDamp, _godot_object);
323 	}
324 	/**
325 	
326 	*/
327 	Vector3 getLinearVelocity() const
328 	{
329 		checkClassBinding!(typeof(this))();
330 		return ptrcall!(Vector3)(GDNativeClassBinding.getLinearVelocity, _godot_object);
331 	}
332 	/**
333 	
334 	*/
335 	double getMass() const
336 	{
337 		checkClassBinding!(typeof(this))();
338 		return ptrcall!(double)(GDNativeClassBinding.getMass, _godot_object);
339 	}
340 	/**
341 	
342 	*/
343 	long getMaxContactsReported() const
344 	{
345 		checkClassBinding!(typeof(this))();
346 		return ptrcall!(long)(GDNativeClassBinding.getMaxContactsReported, _godot_object);
347 	}
348 	/**
349 	
350 	*/
351 	RigidBody.Mode getMode() const
352 	{
353 		checkClassBinding!(typeof(this))();
354 		return ptrcall!(RigidBody.Mode)(GDNativeClassBinding.getMode, _godot_object);
355 	}
356 	/**
357 	
358 	*/
359 	Ref!PhysicsMaterial getPhysicsMaterialOverride() const
360 	{
361 		checkClassBinding!(typeof(this))();
362 		return ptrcall!(PhysicsMaterial)(GDNativeClassBinding.getPhysicsMaterialOverride, _godot_object);
363 	}
364 	/**
365 	
366 	*/
367 	double getWeight() const
368 	{
369 		checkClassBinding!(typeof(this))();
370 		return ptrcall!(double)(GDNativeClassBinding.getWeight, _godot_object);
371 	}
372 	/**
373 	
374 	*/
375 	bool isAbleToSleep() const
376 	{
377 		checkClassBinding!(typeof(this))();
378 		return ptrcall!(bool)(GDNativeClassBinding.isAbleToSleep, _godot_object);
379 	}
380 	/**
381 	
382 	*/
383 	bool isContactMonitorEnabled() const
384 	{
385 		checkClassBinding!(typeof(this))();
386 		return ptrcall!(bool)(GDNativeClassBinding.isContactMonitorEnabled, _godot_object);
387 	}
388 	/**
389 	
390 	*/
391 	bool isSleeping() const
392 	{
393 		checkClassBinding!(typeof(this))();
394 		return ptrcall!(bool)(GDNativeClassBinding.isSleeping, _godot_object);
395 	}
396 	/**
397 	
398 	*/
399 	bool isUsingContinuousCollisionDetection() const
400 	{
401 		checkClassBinding!(typeof(this))();
402 		return ptrcall!(bool)(GDNativeClassBinding.isUsingContinuousCollisionDetection, _godot_object);
403 	}
404 	/**
405 	
406 	*/
407 	bool isUsingCustomIntegrator()
408 	{
409 		checkClassBinding!(typeof(this))();
410 		return ptrcall!(bool)(GDNativeClassBinding.isUsingCustomIntegrator, _godot_object);
411 	}
412 	/**
413 	
414 	*/
415 	void setAngularDamp(in double angular_damp)
416 	{
417 		checkClassBinding!(typeof(this))();
418 		ptrcall!(void)(GDNativeClassBinding.setAngularDamp, _godot_object, angular_damp);
419 	}
420 	/**
421 	
422 	*/
423 	void setAngularVelocity(in Vector3 angular_velocity)
424 	{
425 		checkClassBinding!(typeof(this))();
426 		ptrcall!(void)(GDNativeClassBinding.setAngularVelocity, _godot_object, angular_velocity);
427 	}
428 	/**
429 	Locks the specified linear or rotational axis.
430 	*/
431 	void setAxisLock(in long axis, in bool lock)
432 	{
433 		checkClassBinding!(typeof(this))();
434 		ptrcall!(void)(GDNativeClassBinding.setAxisLock, _godot_object, axis, lock);
435 	}
436 	/**
437 	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.
438 	*/
439 	void setAxisVelocity(in Vector3 axis_velocity)
440 	{
441 		checkClassBinding!(typeof(this))();
442 		ptrcall!(void)(GDNativeClassBinding.setAxisVelocity, _godot_object, axis_velocity);
443 	}
444 	/**
445 	
446 	*/
447 	void setBounce(in double bounce)
448 	{
449 		checkClassBinding!(typeof(this))();
450 		ptrcall!(void)(GDNativeClassBinding.setBounce, _godot_object, bounce);
451 	}
452 	/**
453 	
454 	*/
455 	void setCanSleep(in bool able_to_sleep)
456 	{
457 		checkClassBinding!(typeof(this))();
458 		ptrcall!(void)(GDNativeClassBinding.setCanSleep, _godot_object, able_to_sleep);
459 	}
460 	/**
461 	
462 	*/
463 	void setContactMonitor(in bool enabled)
464 	{
465 		checkClassBinding!(typeof(this))();
466 		ptrcall!(void)(GDNativeClassBinding.setContactMonitor, _godot_object, enabled);
467 	}
468 	/**
469 	
470 	*/
471 	void setFriction(in double friction)
472 	{
473 		checkClassBinding!(typeof(this))();
474 		ptrcall!(void)(GDNativeClassBinding.setFriction, _godot_object, friction);
475 	}
476 	/**
477 	
478 	*/
479 	void setGravityScale(in double gravity_scale)
480 	{
481 		checkClassBinding!(typeof(this))();
482 		ptrcall!(void)(GDNativeClassBinding.setGravityScale, _godot_object, gravity_scale);
483 	}
484 	/**
485 	
486 	*/
487 	void setLinearDamp(in double linear_damp)
488 	{
489 		checkClassBinding!(typeof(this))();
490 		ptrcall!(void)(GDNativeClassBinding.setLinearDamp, _godot_object, linear_damp);
491 	}
492 	/**
493 	
494 	*/
495 	void setLinearVelocity(in Vector3 linear_velocity)
496 	{
497 		checkClassBinding!(typeof(this))();
498 		ptrcall!(void)(GDNativeClassBinding.setLinearVelocity, _godot_object, linear_velocity);
499 	}
500 	/**
501 	
502 	*/
503 	void setMass(in double mass)
504 	{
505 		checkClassBinding!(typeof(this))();
506 		ptrcall!(void)(GDNativeClassBinding.setMass, _godot_object, mass);
507 	}
508 	/**
509 	
510 	*/
511 	void setMaxContactsReported(in long amount)
512 	{
513 		checkClassBinding!(typeof(this))();
514 		ptrcall!(void)(GDNativeClassBinding.setMaxContactsReported, _godot_object, amount);
515 	}
516 	/**
517 	
518 	*/
519 	void setMode(in long mode)
520 	{
521 		checkClassBinding!(typeof(this))();
522 		ptrcall!(void)(GDNativeClassBinding.setMode, _godot_object, mode);
523 	}
524 	/**
525 	
526 	*/
527 	void setPhysicsMaterialOverride(PhysicsMaterial physics_material_override)
528 	{
529 		checkClassBinding!(typeof(this))();
530 		ptrcall!(void)(GDNativeClassBinding.setPhysicsMaterialOverride, _godot_object, physics_material_override);
531 	}
532 	/**
533 	
534 	*/
535 	void setSleeping(in bool sleeping)
536 	{
537 		checkClassBinding!(typeof(this))();
538 		ptrcall!(void)(GDNativeClassBinding.setSleeping, _godot_object, sleeping);
539 	}
540 	/**
541 	
542 	*/
543 	void setUseContinuousCollisionDetection(in bool enable)
544 	{
545 		checkClassBinding!(typeof(this))();
546 		ptrcall!(void)(GDNativeClassBinding.setUseContinuousCollisionDetection, _godot_object, enable);
547 	}
548 	/**
549 	
550 	*/
551 	void setUseCustomIntegrator(in bool enable)
552 	{
553 		checkClassBinding!(typeof(this))();
554 		ptrcall!(void)(GDNativeClassBinding.setUseCustomIntegrator, _godot_object, enable);
555 	}
556 	/**
557 	
558 	*/
559 	void setWeight(in double weight)
560 	{
561 		checkClassBinding!(typeof(this))();
562 		ptrcall!(void)(GDNativeClassBinding.setWeight, _godot_object, weight);
563 	}
564 	/**
565 	Damps RigidBody's rotational forces.
566 	See $(D ProjectSettings.physics/3d/defaultAngularDamp) for more details about damping.
567 	*/
568 	@property double angularDamp()
569 	{
570 		return getAngularDamp();
571 	}
572 	/// ditto
573 	@property void angularDamp(double v)
574 	{
575 		setAngularDamp(v);
576 	}
577 	/**
578 	RigidBody's rotational velocity.
579 	*/
580 	@property Vector3 angularVelocity()
581 	{
582 		return getAngularVelocity();
583 	}
584 	/// ditto
585 	@property void angularVelocity(Vector3 v)
586 	{
587 		setAngularVelocity(v);
588 	}
589 	/**
590 	Lock the body's rotation in the X axis.
591 	*/
592 	@property bool axisLockAngularX()
593 	{
594 		return getAxisLock(8);
595 	}
596 	/// ditto
597 	@property void axisLockAngularX(bool v)
598 	{
599 		setAxisLock(8, v);
600 	}
601 	/**
602 	Lock the body's rotation in the Y axis.
603 	*/
604 	@property bool axisLockAngularY()
605 	{
606 		return getAxisLock(16);
607 	}
608 	/// ditto
609 	@property void axisLockAngularY(bool v)
610 	{
611 		setAxisLock(16, v);
612 	}
613 	/**
614 	Lock the body's rotation in the Z axis.
615 	*/
616 	@property bool axisLockAngularZ()
617 	{
618 		return getAxisLock(32);
619 	}
620 	/// ditto
621 	@property void axisLockAngularZ(bool v)
622 	{
623 		setAxisLock(32, v);
624 	}
625 	/**
626 	Lock the body's movement in the X axis.
627 	*/
628 	@property bool axisLockLinearX()
629 	{
630 		return getAxisLock(1);
631 	}
632 	/// ditto
633 	@property void axisLockLinearX(bool v)
634 	{
635 		setAxisLock(1, v);
636 	}
637 	/**
638 	Lock the body's movement in the Y axis.
639 	*/
640 	@property bool axisLockLinearY()
641 	{
642 		return getAxisLock(2);
643 	}
644 	/// ditto
645 	@property void axisLockLinearY(bool v)
646 	{
647 		setAxisLock(2, v);
648 	}
649 	/**
650 	Lock the body's movement in the Z axis.
651 	*/
652 	@property bool axisLockLinearZ()
653 	{
654 		return getAxisLock(4);
655 	}
656 	/// ditto
657 	@property void axisLockLinearZ(bool v)
658 	{
659 		setAxisLock(4, v);
660 	}
661 	/**
662 	The body's bounciness. Values range from `0` (no bounce) to `1` (full bounciness).
663 	Deprecated, use $(D PhysicsMaterial.bounce) instead via $(D physicsMaterialOverride).
664 	*/
665 	@property double bounce()
666 	{
667 		return getBounce();
668 	}
669 	/// ditto
670 	@property void bounce(double v)
671 	{
672 		setBounce(v);
673 	}
674 	/**
675 	If `true`, the body can enter sleep mode when there is no movement. See $(D sleeping).
676 	$(B Note:) A RigidBody3D 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`.
677 	*/
678 	@property bool canSleep()
679 	{
680 		return isAbleToSleep();
681 	}
682 	/// ditto
683 	@property void canSleep(bool v)
684 	{
685 		setCanSleep(v);
686 	}
687 	/**
688 	If `true`, the RigidBody will emit signals when it collides with another RigidBody. See also $(D contactsReported).
689 	*/
690 	@property bool contactMonitor()
691 	{
692 		return isContactMonitorEnabled();
693 	}
694 	/// ditto
695 	@property void contactMonitor(bool v)
696 	{
697 		setContactMonitor(v);
698 	}
699 	/**
700 	The maximum number of contacts that will be recorded. Requires $(D contactMonitor) to be set to `true`.
701 	$(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), and collisions between parallel faces will result in four contacts (one at each corner).
702 	*/
703 	@property long contactsReported()
704 	{
705 		return getMaxContactsReported();
706 	}
707 	/// ditto
708 	@property void contactsReported(long v)
709 	{
710 		setMaxContactsReported(v);
711 	}
712 	/**
713 	If `true`, continuous collision detection is used.
714 	Continuous collision detection tries to predict where a moving body will collide, instead of moving it and correcting its movement if it collided. Continuous collision detection is more precise, and misses fewer impacts by small, fast-moving objects. Not using continuous collision detection is faster to compute, but can miss small, fast-moving objects.
715 	*/
716 	@property bool continuousCd()
717 	{
718 		return isUsingContinuousCollisionDetection();
719 	}
720 	/// ditto
721 	@property void continuousCd(bool v)
722 	{
723 		setUseContinuousCollisionDetection(v);
724 	}
725 	/**
726 	If `true`, internal force integration will be disabled (like gravity or air friction) for this body. Other than collision response, the body will only move as determined by the $(D _integrateForces) function, if defined.
727 	*/
728 	@property bool customIntegrator()
729 	{
730 		return isUsingCustomIntegrator();
731 	}
732 	/// ditto
733 	@property void customIntegrator(bool v)
734 	{
735 		setUseCustomIntegrator(v);
736 	}
737 	/**
738 	The body's friction, from 0 (frictionless) to 1 (max friction).
739 	Deprecated, use $(D PhysicsMaterial.friction) instead via $(D physicsMaterialOverride).
740 	*/
741 	@property double friction()
742 	{
743 		return getFriction();
744 	}
745 	/// ditto
746 	@property void friction(double v)
747 	{
748 		setFriction(v);
749 	}
750 	/**
751 	This is multiplied by the global 3D gravity setting found in $(B Project > Project Settings > Physics > 3d) to produce RigidBody's gravity. For example, a value of 1 will be normal gravity, 2 will apply double gravity, and 0.5 will apply half gravity to this object.
752 	*/
753 	@property double gravityScale()
754 	{
755 		return getGravityScale();
756 	}
757 	/// ditto
758 	@property void gravityScale(double v)
759 	{
760 		setGravityScale(v);
761 	}
762 	/**
763 	The body's linear damp. Cannot be less than -1.0. If this value is different from -1.0, any linear damp derived from the world or areas will be overridden.
764 	See $(D ProjectSettings.physics/3d/defaultLinearDamp) for more details about damping.
765 	*/
766 	@property double linearDamp()
767 	{
768 		return getLinearDamp();
769 	}
770 	/// ditto
771 	@property void linearDamp(double v)
772 	{
773 		setLinearDamp(v);
774 	}
775 	/**
776 	The body's linear velocity. Can be used sporadically, but $(B don't set this every frame), because physics may run in another thread and runs at a different granularity. Use $(D _integrateForces) as your process loop for precise control of the body state.
777 	*/
778 	@property Vector3 linearVelocity()
779 	{
780 		return getLinearVelocity();
781 	}
782 	/// ditto
783 	@property void linearVelocity(Vector3 v)
784 	{
785 		setLinearVelocity(v);
786 	}
787 	/**
788 	The body's mass.
789 	*/
790 	@property double mass()
791 	{
792 		return getMass();
793 	}
794 	/// ditto
795 	@property void mass(double v)
796 	{
797 		setMass(v);
798 	}
799 	/**
800 	The body mode. See $(D mode) for possible values.
801 	*/
802 	@property RigidBody.Mode mode()
803 	{
804 		return getMode();
805 	}
806 	/// ditto
807 	@property void mode(long v)
808 	{
809 		setMode(v);
810 	}
811 	/**
812 	The physics material override for the body.
813 	If a material is assigned to this property, it will be used instead of any other physics material, such as an inherited one.
814 	*/
815 	@property PhysicsMaterial physicsMaterialOverride()
816 	{
817 		return getPhysicsMaterialOverride();
818 	}
819 	/// ditto
820 	@property void physicsMaterialOverride(PhysicsMaterial v)
821 	{
822 		setPhysicsMaterialOverride(v);
823 	}
824 	/**
825 	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.
826 	*/
827 	@property bool sleeping()
828 	{
829 		return isSleeping();
830 	}
831 	/// ditto
832 	@property void sleeping(bool v)
833 	{
834 		setSleeping(v);
835 	}
836 	/**
837 	The body's weight based on its mass and the global 3D gravity. Global values are set in $(B Project > Project Settings > Physics > 3d).
838 	*/
839 	@property double weight()
840 	{
841 		return getWeight();
842 	}
843 	/// ditto
844 	@property void weight(double v)
845 	{
846 		setWeight(v);
847 	}
848 }