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