1 /**
2 A soft mesh physics body.
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.softbody;
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.meshinstance;
25 import godot.geometryinstance;
26 import godot.visualinstance;
27 import godot.node;
28 /**
29 A soft mesh physics body.
30 
31 A deformable physics body. Used to create elastic or deformable objects such as cloth, rubber, or other flexible materials.
32 */
33 @GodotBaseClass struct SoftBody
34 {
35 	package(godot) enum string _GODOT_internal_name = "SoftBody";
36 public:
37 @nogc nothrow:
38 	union { /** */ godot_object _godot_object; /** */ MeshInstance _GODOT_base; }
39 	alias _GODOT_base this;
40 	alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses);
41 	package(godot) __gshared bool _classBindingInitialized = false;
42 	package(godot) static struct GDNativeClassBinding
43 	{
44 		__gshared:
45 		@GodotName("_draw_soft_mesh") GodotMethod!(void) _drawSoftMesh;
46 		@GodotName("add_collision_exception_with") GodotMethod!(void, Node) addCollisionExceptionWith;
47 		@GodotName("get_areaAngular_stiffness") GodotMethod!(double) getAreaangularStiffness;
48 		@GodotName("get_collision_exceptions") GodotMethod!(Array) getCollisionExceptions;
49 		@GodotName("get_collision_layer") GodotMethod!(long) getCollisionLayer;
50 		@GodotName("get_collision_layer_bit") GodotMethod!(bool, long) getCollisionLayerBit;
51 		@GodotName("get_collision_mask") GodotMethod!(long) getCollisionMask;
52 		@GodotName("get_collision_mask_bit") GodotMethod!(bool, long) getCollisionMaskBit;
53 		@GodotName("get_damping_coefficient") GodotMethod!(double) getDampingCoefficient;
54 		@GodotName("get_drag_coefficient") GodotMethod!(double) getDragCoefficient;
55 		@GodotName("get_linear_stiffness") GodotMethod!(double) getLinearStiffness;
56 		@GodotName("get_parent_collision_ignore") GodotMethod!(NodePath) getParentCollisionIgnore;
57 		@GodotName("get_pose_matching_coefficient") GodotMethod!(double) getPoseMatchingCoefficient;
58 		@GodotName("get_pressure_coefficient") GodotMethod!(double) getPressureCoefficient;
59 		@GodotName("get_simulation_precision") GodotMethod!(long) getSimulationPrecision;
60 		@GodotName("get_total_mass") GodotMethod!(double) getTotalMass;
61 		@GodotName("get_volume_stiffness") GodotMethod!(double) getVolumeStiffness;
62 		@GodotName("is_ray_pickable") GodotMethod!(bool) isRayPickable;
63 		@GodotName("remove_collision_exception_with") GodotMethod!(void, Node) removeCollisionExceptionWith;
64 		@GodotName("set_areaAngular_stiffness") GodotMethod!(void, double) setAreaangularStiffness;
65 		@GodotName("set_collision_layer") GodotMethod!(void, long) setCollisionLayer;
66 		@GodotName("set_collision_layer_bit") GodotMethod!(void, long, bool) setCollisionLayerBit;
67 		@GodotName("set_collision_mask") GodotMethod!(void, long) setCollisionMask;
68 		@GodotName("set_collision_mask_bit") GodotMethod!(void, long, bool) setCollisionMaskBit;
69 		@GodotName("set_damping_coefficient") GodotMethod!(void, double) setDampingCoefficient;
70 		@GodotName("set_drag_coefficient") GodotMethod!(void, double) setDragCoefficient;
71 		@GodotName("set_linear_stiffness") GodotMethod!(void, double) setLinearStiffness;
72 		@GodotName("set_parent_collision_ignore") GodotMethod!(void, NodePath) setParentCollisionIgnore;
73 		@GodotName("set_pose_matching_coefficient") GodotMethod!(void, double) setPoseMatchingCoefficient;
74 		@GodotName("set_pressure_coefficient") GodotMethod!(void, double) setPressureCoefficient;
75 		@GodotName("set_ray_pickable") GodotMethod!(void, bool) setRayPickable;
76 		@GodotName("set_simulation_precision") GodotMethod!(void, long) setSimulationPrecision;
77 		@GodotName("set_total_mass") GodotMethod!(void, double) setTotalMass;
78 		@GodotName("set_volume_stiffness") GodotMethod!(void, double) setVolumeStiffness;
79 	}
80 	/// 
81 	pragma(inline, true) bool opEquals(in SoftBody other) const
82 	{ return _godot_object.ptr is other._godot_object.ptr; }
83 	/// 
84 	pragma(inline, true) typeof(null) opAssign(typeof(null) n)
85 	{ _godot_object.ptr = n; return null; }
86 	/// 
87 	pragma(inline, true) bool opEquals(typeof(null) n) const
88 	{ return _godot_object.ptr is n; }
89 	/// 
90 	size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; }
91 	mixin baseCasts;
92 	/// Construct a new instance of SoftBody.
93 	/// Note: use `memnew!SoftBody` instead.
94 	static SoftBody _new()
95 	{
96 		static godot_class_constructor constructor;
97 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("SoftBody");
98 		if(constructor is null) return typeof(this).init;
99 		return cast(SoftBody)(constructor());
100 	}
101 	@disable new(size_t s);
102 	/**
103 	
104 	*/
105 	void _drawSoftMesh()
106 	{
107 		Array _GODOT_args = Array.make();
108 		String _GODOT_method_name = String("_draw_soft_mesh");
109 		this.callv(_GODOT_method_name, _GODOT_args);
110 	}
111 	/**
112 	Adds a body to the list of bodies that this body can't collide with.
113 	*/
114 	void addCollisionExceptionWith(Node _body)
115 	{
116 		checkClassBinding!(typeof(this))();
117 		ptrcall!(void)(GDNativeClassBinding.addCollisionExceptionWith, _godot_object, _body);
118 	}
119 	/**
120 	
121 	*/
122 	double getAreaangularStiffness()
123 	{
124 		checkClassBinding!(typeof(this))();
125 		return ptrcall!(double)(GDNativeClassBinding.getAreaangularStiffness, _godot_object);
126 	}
127 	/**
128 	Returns an array of nodes that were added as collision exceptions for this body.
129 	*/
130 	Array getCollisionExceptions()
131 	{
132 		checkClassBinding!(typeof(this))();
133 		return ptrcall!(Array)(GDNativeClassBinding.getCollisionExceptions, _godot_object);
134 	}
135 	/**
136 	
137 	*/
138 	long getCollisionLayer() const
139 	{
140 		checkClassBinding!(typeof(this))();
141 		return ptrcall!(long)(GDNativeClassBinding.getCollisionLayer, _godot_object);
142 	}
143 	/**
144 	Returns an individual bit on the collision mask.
145 	*/
146 	bool getCollisionLayerBit(in long bit) const
147 	{
148 		checkClassBinding!(typeof(this))();
149 		return ptrcall!(bool)(GDNativeClassBinding.getCollisionLayerBit, _godot_object, bit);
150 	}
151 	/**
152 	
153 	*/
154 	long getCollisionMask() const
155 	{
156 		checkClassBinding!(typeof(this))();
157 		return ptrcall!(long)(GDNativeClassBinding.getCollisionMask, _godot_object);
158 	}
159 	/**
160 	Returns an individual bit on the collision mask.
161 	*/
162 	bool getCollisionMaskBit(in long bit) const
163 	{
164 		checkClassBinding!(typeof(this))();
165 		return ptrcall!(bool)(GDNativeClassBinding.getCollisionMaskBit, _godot_object, bit);
166 	}
167 	/**
168 	
169 	*/
170 	double getDampingCoefficient()
171 	{
172 		checkClassBinding!(typeof(this))();
173 		return ptrcall!(double)(GDNativeClassBinding.getDampingCoefficient, _godot_object);
174 	}
175 	/**
176 	
177 	*/
178 	double getDragCoefficient()
179 	{
180 		checkClassBinding!(typeof(this))();
181 		return ptrcall!(double)(GDNativeClassBinding.getDragCoefficient, _godot_object);
182 	}
183 	/**
184 	
185 	*/
186 	double getLinearStiffness()
187 	{
188 		checkClassBinding!(typeof(this))();
189 		return ptrcall!(double)(GDNativeClassBinding.getLinearStiffness, _godot_object);
190 	}
191 	/**
192 	
193 	*/
194 	NodePath getParentCollisionIgnore() const
195 	{
196 		checkClassBinding!(typeof(this))();
197 		return ptrcall!(NodePath)(GDNativeClassBinding.getParentCollisionIgnore, _godot_object);
198 	}
199 	/**
200 	
201 	*/
202 	double getPoseMatchingCoefficient()
203 	{
204 		checkClassBinding!(typeof(this))();
205 		return ptrcall!(double)(GDNativeClassBinding.getPoseMatchingCoefficient, _godot_object);
206 	}
207 	/**
208 	
209 	*/
210 	double getPressureCoefficient()
211 	{
212 		checkClassBinding!(typeof(this))();
213 		return ptrcall!(double)(GDNativeClassBinding.getPressureCoefficient, _godot_object);
214 	}
215 	/**
216 	
217 	*/
218 	long getSimulationPrecision()
219 	{
220 		checkClassBinding!(typeof(this))();
221 		return ptrcall!(long)(GDNativeClassBinding.getSimulationPrecision, _godot_object);
222 	}
223 	/**
224 	
225 	*/
226 	double getTotalMass()
227 	{
228 		checkClassBinding!(typeof(this))();
229 		return ptrcall!(double)(GDNativeClassBinding.getTotalMass, _godot_object);
230 	}
231 	/**
232 	
233 	*/
234 	double getVolumeStiffness()
235 	{
236 		checkClassBinding!(typeof(this))();
237 		return ptrcall!(double)(GDNativeClassBinding.getVolumeStiffness, _godot_object);
238 	}
239 	/**
240 	
241 	*/
242 	bool isRayPickable() const
243 	{
244 		checkClassBinding!(typeof(this))();
245 		return ptrcall!(bool)(GDNativeClassBinding.isRayPickable, _godot_object);
246 	}
247 	/**
248 	Removes a body from the list of bodies that this body can't collide with.
249 	*/
250 	void removeCollisionExceptionWith(Node _body)
251 	{
252 		checkClassBinding!(typeof(this))();
253 		ptrcall!(void)(GDNativeClassBinding.removeCollisionExceptionWith, _godot_object, _body);
254 	}
255 	/**
256 	
257 	*/
258 	void setAreaangularStiffness(in double areaAngular_stiffness)
259 	{
260 		checkClassBinding!(typeof(this))();
261 		ptrcall!(void)(GDNativeClassBinding.setAreaangularStiffness, _godot_object, areaAngular_stiffness);
262 	}
263 	/**
264 	
265 	*/
266 	void setCollisionLayer(in long collision_layer)
267 	{
268 		checkClassBinding!(typeof(this))();
269 		ptrcall!(void)(GDNativeClassBinding.setCollisionLayer, _godot_object, collision_layer);
270 	}
271 	/**
272 	Sets individual bits on the layer mask. Use this if you only need to change one layer's value.
273 	*/
274 	void setCollisionLayerBit(in long bit, in bool value)
275 	{
276 		checkClassBinding!(typeof(this))();
277 		ptrcall!(void)(GDNativeClassBinding.setCollisionLayerBit, _godot_object, bit, value);
278 	}
279 	/**
280 	
281 	*/
282 	void setCollisionMask(in long collision_mask)
283 	{
284 		checkClassBinding!(typeof(this))();
285 		ptrcall!(void)(GDNativeClassBinding.setCollisionMask, _godot_object, collision_mask);
286 	}
287 	/**
288 	Sets individual bits on the collision mask. Use this if you only need to change one layer's value.
289 	*/
290 	void setCollisionMaskBit(in long bit, in bool value)
291 	{
292 		checkClassBinding!(typeof(this))();
293 		ptrcall!(void)(GDNativeClassBinding.setCollisionMaskBit, _godot_object, bit, value);
294 	}
295 	/**
296 	
297 	*/
298 	void setDampingCoefficient(in double damping_coefficient)
299 	{
300 		checkClassBinding!(typeof(this))();
301 		ptrcall!(void)(GDNativeClassBinding.setDampingCoefficient, _godot_object, damping_coefficient);
302 	}
303 	/**
304 	
305 	*/
306 	void setDragCoefficient(in double drag_coefficient)
307 	{
308 		checkClassBinding!(typeof(this))();
309 		ptrcall!(void)(GDNativeClassBinding.setDragCoefficient, _godot_object, drag_coefficient);
310 	}
311 	/**
312 	
313 	*/
314 	void setLinearStiffness(in double linear_stiffness)
315 	{
316 		checkClassBinding!(typeof(this))();
317 		ptrcall!(void)(GDNativeClassBinding.setLinearStiffness, _godot_object, linear_stiffness);
318 	}
319 	/**
320 	
321 	*/
322 	void setParentCollisionIgnore(NodePathArg0)(in NodePathArg0 parent_collision_ignore)
323 	{
324 		checkClassBinding!(typeof(this))();
325 		ptrcall!(void)(GDNativeClassBinding.setParentCollisionIgnore, _godot_object, parent_collision_ignore);
326 	}
327 	/**
328 	
329 	*/
330 	void setPoseMatchingCoefficient(in double pose_matching_coefficient)
331 	{
332 		checkClassBinding!(typeof(this))();
333 		ptrcall!(void)(GDNativeClassBinding.setPoseMatchingCoefficient, _godot_object, pose_matching_coefficient);
334 	}
335 	/**
336 	
337 	*/
338 	void setPressureCoefficient(in double pressure_coefficient)
339 	{
340 		checkClassBinding!(typeof(this))();
341 		ptrcall!(void)(GDNativeClassBinding.setPressureCoefficient, _godot_object, pressure_coefficient);
342 	}
343 	/**
344 	
345 	*/
346 	void setRayPickable(in bool ray_pickable)
347 	{
348 		checkClassBinding!(typeof(this))();
349 		ptrcall!(void)(GDNativeClassBinding.setRayPickable, _godot_object, ray_pickable);
350 	}
351 	/**
352 	
353 	*/
354 	void setSimulationPrecision(in long simulation_precision)
355 	{
356 		checkClassBinding!(typeof(this))();
357 		ptrcall!(void)(GDNativeClassBinding.setSimulationPrecision, _godot_object, simulation_precision);
358 	}
359 	/**
360 	
361 	*/
362 	void setTotalMass(in double mass)
363 	{
364 		checkClassBinding!(typeof(this))();
365 		ptrcall!(void)(GDNativeClassBinding.setTotalMass, _godot_object, mass);
366 	}
367 	/**
368 	
369 	*/
370 	void setVolumeStiffness(in double volume_stiffness)
371 	{
372 		checkClassBinding!(typeof(this))();
373 		ptrcall!(void)(GDNativeClassBinding.setVolumeStiffness, _godot_object, volume_stiffness);
374 	}
375 	/**
376 	
377 	*/
378 	@property double areaangularStiffness()
379 	{
380 		return getAreaangularStiffness();
381 	}
382 	/// ditto
383 	@property void areaangularStiffness(double v)
384 	{
385 		setAreaangularStiffness(v);
386 	}
387 	/**
388 	The physics layers this SoftBody is in.
389 	Collidable objects can exist in any of 32 different layers. These layers work like a tagging system, and are not visual. A collidable can use these layers to select with which objects it can collide, using the collision_mask property.
390 	A contact is detected if object A is in any of the layers that object B scans, or object B is in any layer scanned by object A. See $(D url=https://docs.godotengine.org/en/3.3/tutorials/physics/physics_introduction.html#collision-layers-and-masks)Collision layers and masks$(D /url) in the documentation for more information.
391 	*/
392 	@property long collisionLayer()
393 	{
394 		return getCollisionLayer();
395 	}
396 	/// ditto
397 	@property void collisionLayer(long v)
398 	{
399 		setCollisionLayer(v);
400 	}
401 	/**
402 	The physics layers this SoftBody scans for collisions. See $(D url=https://docs.godotengine.org/en/3.3/tutorials/physics/physics_introduction.html#collision-layers-and-masks)Collision layers and masks$(D /url) in the documentation for more information.
403 	*/
404 	@property long collisionMask()
405 	{
406 		return getCollisionMask();
407 	}
408 	/// ditto
409 	@property void collisionMask(long v)
410 	{
411 		setCollisionMask(v);
412 	}
413 	/**
414 	
415 	*/
416 	@property double dampingCoefficient()
417 	{
418 		return getDampingCoefficient();
419 	}
420 	/// ditto
421 	@property void dampingCoefficient(double v)
422 	{
423 		setDampingCoefficient(v);
424 	}
425 	/**
426 	
427 	*/
428 	@property double dragCoefficient()
429 	{
430 		return getDragCoefficient();
431 	}
432 	/// ditto
433 	@property void dragCoefficient(double v)
434 	{
435 		setDragCoefficient(v);
436 	}
437 	/**
438 	
439 	*/
440 	@property double linearStiffness()
441 	{
442 		return getLinearStiffness();
443 	}
444 	/// ditto
445 	@property void linearStiffness(double v)
446 	{
447 		setLinearStiffness(v);
448 	}
449 	/**
450 	$(D NodePath) to a $(D CollisionObject) this SoftBody should avoid clipping.
451 	*/
452 	@property NodePath parentCollisionIgnore()
453 	{
454 		return getParentCollisionIgnore();
455 	}
456 	/// ditto
457 	@property void parentCollisionIgnore(NodePath v)
458 	{
459 		setParentCollisionIgnore(v);
460 	}
461 	/**
462 	
463 	*/
464 	@property double poseMatchingCoefficient()
465 	{
466 		return getPoseMatchingCoefficient();
467 	}
468 	/// ditto
469 	@property void poseMatchingCoefficient(double v)
470 	{
471 		setPoseMatchingCoefficient(v);
472 	}
473 	/**
474 	
475 	*/
476 	@property double pressureCoefficient()
477 	{
478 		return getPressureCoefficient();
479 	}
480 	/// ditto
481 	@property void pressureCoefficient(double v)
482 	{
483 		setPressureCoefficient(v);
484 	}
485 	/**
486 	If `true`, the $(D SoftBody) will respond to $(D RayCast)s.
487 	*/
488 	@property bool rayPickable()
489 	{
490 		return isRayPickable();
491 	}
492 	/// ditto
493 	@property void rayPickable(bool v)
494 	{
495 		setRayPickable(v);
496 	}
497 	/**
498 	Increasing this value will improve the resulting simulation, but can affect performance. Use with care.
499 	*/
500 	@property long simulationPrecision()
501 	{
502 		return getSimulationPrecision();
503 	}
504 	/// ditto
505 	@property void simulationPrecision(long v)
506 	{
507 		setSimulationPrecision(v);
508 	}
509 	/**
510 	The SoftBody's mass.
511 	*/
512 	@property double totalMass()
513 	{
514 		return getTotalMass();
515 	}
516 	/// ditto
517 	@property void totalMass(double v)
518 	{
519 		setTotalMass(v);
520 	}
521 	/**
522 	
523 	*/
524 	@property double volumeStiffness()
525 	{
526 		return getVolumeStiffness();
527 	}
528 	/// ditto
529 	@property void volumeStiffness(double v)
530 	{
531 		setVolumeStiffness(v);
532 	}
533 }