1 /**
2 Base class for all 3D joints.
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.joint;
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.spatial;
24 /**
25 Base class for all 3D joints.
26 
27 Joints are used to bind together two physics bodies. They have a solver priority and can define if the bodies of the two attached nodes should be able to collide with each other.
28 */
29 @GodotBaseClass struct Joint
30 {
31 	package(godot) enum string _GODOT_internal_name = "Joint";
32 public:
33 @nogc nothrow:
34 	union { /** */ godot_object _godot_object; /** */ Spatial _GODOT_base; }
35 	alias _GODOT_base this;
36 	alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses);
37 	package(godot) __gshared bool _classBindingInitialized = false;
38 	package(godot) static struct GDNativeClassBinding
39 	{
40 		__gshared:
41 		@GodotName("_body_exit_tree") GodotMethod!(void) _bodyExitTree;
42 		@GodotName("get_exclude_nodes_from_collision") GodotMethod!(bool) getExcludeNodesFromCollision;
43 		@GodotName("get_node_a") GodotMethod!(NodePath) getNodeA;
44 		@GodotName("get_node_b") GodotMethod!(NodePath) getNodeB;
45 		@GodotName("get_solver_priority") GodotMethod!(long) getSolverPriority;
46 		@GodotName("set_exclude_nodes_from_collision") GodotMethod!(void, bool) setExcludeNodesFromCollision;
47 		@GodotName("set_node_a") GodotMethod!(void, NodePath) setNodeA;
48 		@GodotName("set_node_b") GodotMethod!(void, NodePath) setNodeB;
49 		@GodotName("set_solver_priority") GodotMethod!(void, long) setSolverPriority;
50 	}
51 	/// 
52 	pragma(inline, true) bool opEquals(in Joint other) const
53 	{ return _godot_object.ptr is other._godot_object.ptr; }
54 	/// 
55 	pragma(inline, true) typeof(null) opAssign(typeof(null) n)
56 	{ _godot_object.ptr = n; return null; }
57 	/// 
58 	pragma(inline, true) bool opEquals(typeof(null) n) const
59 	{ return _godot_object.ptr is n; }
60 	/// 
61 	size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; }
62 	mixin baseCasts;
63 	/// Construct a new instance of Joint.
64 	/// Note: use `memnew!Joint` instead.
65 	static Joint _new()
66 	{
67 		static godot_class_constructor constructor;
68 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("Joint");
69 		if(constructor is null) return typeof(this).init;
70 		return cast(Joint)(constructor());
71 	}
72 	@disable new(size_t s);
73 	/**
74 	
75 	*/
76 	void _bodyExitTree()
77 	{
78 		Array _GODOT_args = Array.make();
79 		String _GODOT_method_name = String("_body_exit_tree");
80 		this.callv(_GODOT_method_name, _GODOT_args);
81 	}
82 	/**
83 	
84 	*/
85 	bool getExcludeNodesFromCollision() const
86 	{
87 		checkClassBinding!(typeof(this))();
88 		return ptrcall!(bool)(GDNativeClassBinding.getExcludeNodesFromCollision, _godot_object);
89 	}
90 	/**
91 	
92 	*/
93 	NodePath getNodeA() const
94 	{
95 		checkClassBinding!(typeof(this))();
96 		return ptrcall!(NodePath)(GDNativeClassBinding.getNodeA, _godot_object);
97 	}
98 	/**
99 	
100 	*/
101 	NodePath getNodeB() const
102 	{
103 		checkClassBinding!(typeof(this))();
104 		return ptrcall!(NodePath)(GDNativeClassBinding.getNodeB, _godot_object);
105 	}
106 	/**
107 	
108 	*/
109 	long getSolverPriority() const
110 	{
111 		checkClassBinding!(typeof(this))();
112 		return ptrcall!(long)(GDNativeClassBinding.getSolverPriority, _godot_object);
113 	}
114 	/**
115 	
116 	*/
117 	void setExcludeNodesFromCollision(in bool enable)
118 	{
119 		checkClassBinding!(typeof(this))();
120 		ptrcall!(void)(GDNativeClassBinding.setExcludeNodesFromCollision, _godot_object, enable);
121 	}
122 	/**
123 	
124 	*/
125 	void setNodeA(NodePathArg0)(in NodePathArg0 node)
126 	{
127 		checkClassBinding!(typeof(this))();
128 		ptrcall!(void)(GDNativeClassBinding.setNodeA, _godot_object, node);
129 	}
130 	/**
131 	
132 	*/
133 	void setNodeB(NodePathArg0)(in NodePathArg0 node)
134 	{
135 		checkClassBinding!(typeof(this))();
136 		ptrcall!(void)(GDNativeClassBinding.setNodeB, _godot_object, node);
137 	}
138 	/**
139 	
140 	*/
141 	void setSolverPriority(in long priority)
142 	{
143 		checkClassBinding!(typeof(this))();
144 		ptrcall!(void)(GDNativeClassBinding.setSolverPriority, _godot_object, priority);
145 	}
146 	/**
147 	If `true`, the two bodies of the nodes are not able to collide with each other.
148 	*/
149 	@property bool collisionExcludeNodes()
150 	{
151 		return getExcludeNodesFromCollision();
152 	}
153 	/// ditto
154 	@property void collisionExcludeNodes(bool v)
155 	{
156 		setExcludeNodesFromCollision(v);
157 	}
158 	/**
159 	The node attached to the first side (A) of the joint.
160 	*/
161 	@property NodePath nodesNodeA()
162 	{
163 		return getNodeA();
164 	}
165 	/// ditto
166 	@property void nodesNodeA(NodePath v)
167 	{
168 		setNodeA(v);
169 	}
170 	/**
171 	The node attached to the second side (B) of the joint.
172 	*/
173 	@property NodePath nodesNodeB()
174 	{
175 		return getNodeB();
176 	}
177 	/// ditto
178 	@property void nodesNodeB(NodePath v)
179 	{
180 		setNodeB(v);
181 	}
182 	/**
183 	The priority used to define which solver is executed first for multiple joints. The lower the value, the higher the priority.
184 	*/
185 	@property long solverPriority()
186 	{
187 		return getSolverPriority();
188 	}
189 	/// ditto
190 	@property void solverPriority(long v)
191 	{
192 		setSolverPriority(v);
193 	}
194 }