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.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.spatial;
23 import godot.node;
24 /**
25 Base class for all 3D joints
26 
27 All 3D joints link two nodes, has a priority, and can decide if the two bodies of the nodes should be able to collide with each other
28 */
29 @GodotBaseClass struct Joint
30 {
31 	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 _classBinding
39 	{
40 		__gshared:
41 		@GodotName("set_node_a") GodotMethod!(void, NodePath) setNodeA;
42 		@GodotName("get_node_a") GodotMethod!(NodePath) getNodeA;
43 		@GodotName("set_node_b") GodotMethod!(void, NodePath) setNodeB;
44 		@GodotName("get_node_b") GodotMethod!(NodePath) getNodeB;
45 		@GodotName("set_solver_priority") GodotMethod!(void, long) setSolverPriority;
46 		@GodotName("get_solver_priority") GodotMethod!(long) getSolverPriority;
47 		@GodotName("set_exclude_nodes_from_collision") GodotMethod!(void, bool) setExcludeNodesFromCollision;
48 		@GodotName("get_exclude_nodes_from_collision") GodotMethod!(bool) getExcludeNodesFromCollision;
49 	}
50 	bool opEquals(in Joint other) const { return _godot_object.ptr is other._godot_object.ptr; }
51 	Joint opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; }
52 	bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; }
53 	mixin baseCasts;
54 	static Joint _new()
55 	{
56 		static godot_class_constructor constructor;
57 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("Joint");
58 		if(constructor is null) return typeof(this).init;
59 		return cast(Joint)(constructor());
60 	}
61 	@disable new(size_t s);
62 	/**
63 	
64 	*/
65 	void setNodeA(NodePathArg0)(in NodePathArg0 node)
66 	{
67 		checkClassBinding!(typeof(this))();
68 		ptrcall!(void)(_classBinding.setNodeA, _godot_object, node);
69 	}
70 	/**
71 	
72 	*/
73 	NodePath getNodeA() const
74 	{
75 		checkClassBinding!(typeof(this))();
76 		return ptrcall!(NodePath)(_classBinding.getNodeA, _godot_object);
77 	}
78 	/**
79 	
80 	*/
81 	void setNodeB(NodePathArg0)(in NodePathArg0 node)
82 	{
83 		checkClassBinding!(typeof(this))();
84 		ptrcall!(void)(_classBinding.setNodeB, _godot_object, node);
85 	}
86 	/**
87 	
88 	*/
89 	NodePath getNodeB() const
90 	{
91 		checkClassBinding!(typeof(this))();
92 		return ptrcall!(NodePath)(_classBinding.getNodeB, _godot_object);
93 	}
94 	/**
95 	
96 	*/
97 	void setSolverPriority(in long priority)
98 	{
99 		checkClassBinding!(typeof(this))();
100 		ptrcall!(void)(_classBinding.setSolverPriority, _godot_object, priority);
101 	}
102 	/**
103 	
104 	*/
105 	long getSolverPriority() const
106 	{
107 		checkClassBinding!(typeof(this))();
108 		return ptrcall!(long)(_classBinding.getSolverPriority, _godot_object);
109 	}
110 	/**
111 	
112 	*/
113 	void setExcludeNodesFromCollision(in bool enable)
114 	{
115 		checkClassBinding!(typeof(this))();
116 		ptrcall!(void)(_classBinding.setExcludeNodesFromCollision, _godot_object, enable);
117 	}
118 	/**
119 	
120 	*/
121 	bool getExcludeNodesFromCollision() const
122 	{
123 		checkClassBinding!(typeof(this))();
124 		return ptrcall!(bool)(_classBinding.getExcludeNodesFromCollision, _godot_object);
125 	}
126 	/**
127 	The $(D Node), the first side of the Joint attaches to.
128 	*/
129 	@property NodePath nodesNodeA()
130 	{
131 		return getNodeA();
132 	}
133 	/// ditto
134 	@property void nodesNodeA(NodePath v)
135 	{
136 		setNodeA(v);
137 	}
138 	/**
139 	The $(D Node), the second side of the Joint attaches to.
140 	*/
141 	@property NodePath nodesNodeB()
142 	{
143 		return getNodeB();
144 	}
145 	/// ditto
146 	@property void nodesNodeB(NodePath v)
147 	{
148 		setNodeB(v);
149 	}
150 	/**
151 	The order in which the solver is executed compared to the other $(D Joints), the lower, the earlier.
152 	*/
153 	@property long solverPriority()
154 	{
155 		return getSolverPriority();
156 	}
157 	/// ditto
158 	@property void solverPriority(long v)
159 	{
160 		setSolverPriority(v);
161 	}
162 	/**
163 	If `true` the two bodies of the nodes are not able to collide with each other.
164 	*/
165 	@property bool collisionExcludeNodes()
166 	{
167 		return getExcludeNodesFromCollision();
168 	}
169 	/// ditto
170 	@property void collisionExcludeNodes(bool v)
171 	{
172 		setExcludeNodesFromCollision(v);
173 	}
174 }