1 /** 2 Parameters to be sent to a 3D shape physics query. 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.physicsshapequeryparameters; 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.reference; 25 import godot.resource; 26 /** 27 Parameters to be sent to a 3D shape physics query. 28 29 This class contains the shape and other parameters for 3D intersection/collision queries. See also $(D PhysicsShapeQueryResult). 30 */ 31 @GodotBaseClass struct PhysicsShapeQueryParameters 32 { 33 package(godot) enum string _GODOT_internal_name = "PhysicsShapeQueryParameters"; 34 public: 35 @nogc nothrow: 36 union { /** */ godot_object _godot_object; /** */ Reference _GODOT_base; } 37 alias _GODOT_base this; 38 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 39 package(godot) __gshared bool _classBindingInitialized = false; 40 package(godot) static struct GDNativeClassBinding 41 { 42 __gshared: 43 @GodotName("get_collision_mask") GodotMethod!(long) getCollisionMask; 44 @GodotName("get_exclude") GodotMethod!(Array) getExclude; 45 @GodotName("get_margin") GodotMethod!(double) getMargin; 46 @GodotName("get_shape_rid") GodotMethod!(RID) getShapeRid; 47 @GodotName("get_transform") GodotMethod!(Transform) getTransform; 48 @GodotName("is_collide_with_areas_enabled") GodotMethod!(bool) isCollideWithAreasEnabled; 49 @GodotName("is_collide_with_bodies_enabled") GodotMethod!(bool) isCollideWithBodiesEnabled; 50 @GodotName("set_collide_with_areas") GodotMethod!(void, bool) setCollideWithAreas; 51 @GodotName("set_collide_with_bodies") GodotMethod!(void, bool) setCollideWithBodies; 52 @GodotName("set_collision_mask") GodotMethod!(void, long) setCollisionMask; 53 @GodotName("set_exclude") GodotMethod!(void, Array) setExclude; 54 @GodotName("set_margin") GodotMethod!(void, double) setMargin; 55 @GodotName("set_shape") GodotMethod!(void, Resource) setShape; 56 @GodotName("set_shape_rid") GodotMethod!(void, RID) setShapeRid; 57 @GodotName("set_transform") GodotMethod!(void, Transform) setTransform; 58 } 59 /// 60 pragma(inline, true) bool opEquals(in PhysicsShapeQueryParameters other) const 61 { return _godot_object.ptr is other._godot_object.ptr; } 62 /// 63 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 64 { _godot_object.ptr = n; return null; } 65 /// 66 pragma(inline, true) bool opEquals(typeof(null) n) const 67 { return _godot_object.ptr is n; } 68 /// 69 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 70 mixin baseCasts; 71 /// Construct a new instance of PhysicsShapeQueryParameters. 72 /// Note: use `memnew!PhysicsShapeQueryParameters` instead. 73 static PhysicsShapeQueryParameters _new() 74 { 75 static godot_class_constructor constructor; 76 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("PhysicsShapeQueryParameters"); 77 if(constructor is null) return typeof(this).init; 78 return cast(PhysicsShapeQueryParameters)(constructor()); 79 } 80 @disable new(size_t s); 81 /** 82 83 */ 84 long getCollisionMask() const 85 { 86 checkClassBinding!(typeof(this))(); 87 return ptrcall!(long)(GDNativeClassBinding.getCollisionMask, _godot_object); 88 } 89 /** 90 91 */ 92 Array getExclude() const 93 { 94 checkClassBinding!(typeof(this))(); 95 return ptrcall!(Array)(GDNativeClassBinding.getExclude, _godot_object); 96 } 97 /** 98 99 */ 100 double getMargin() const 101 { 102 checkClassBinding!(typeof(this))(); 103 return ptrcall!(double)(GDNativeClassBinding.getMargin, _godot_object); 104 } 105 /** 106 107 */ 108 RID getShapeRid() const 109 { 110 checkClassBinding!(typeof(this))(); 111 return ptrcall!(RID)(GDNativeClassBinding.getShapeRid, _godot_object); 112 } 113 /** 114 115 */ 116 Transform getTransform() const 117 { 118 checkClassBinding!(typeof(this))(); 119 return ptrcall!(Transform)(GDNativeClassBinding.getTransform, _godot_object); 120 } 121 /** 122 123 */ 124 bool isCollideWithAreasEnabled() const 125 { 126 checkClassBinding!(typeof(this))(); 127 return ptrcall!(bool)(GDNativeClassBinding.isCollideWithAreasEnabled, _godot_object); 128 } 129 /** 130 131 */ 132 bool isCollideWithBodiesEnabled() const 133 { 134 checkClassBinding!(typeof(this))(); 135 return ptrcall!(bool)(GDNativeClassBinding.isCollideWithBodiesEnabled, _godot_object); 136 } 137 /** 138 139 */ 140 void setCollideWithAreas(in bool enable) 141 { 142 checkClassBinding!(typeof(this))(); 143 ptrcall!(void)(GDNativeClassBinding.setCollideWithAreas, _godot_object, enable); 144 } 145 /** 146 147 */ 148 void setCollideWithBodies(in bool enable) 149 { 150 checkClassBinding!(typeof(this))(); 151 ptrcall!(void)(GDNativeClassBinding.setCollideWithBodies, _godot_object, enable); 152 } 153 /** 154 155 */ 156 void setCollisionMask(in long collision_mask) 157 { 158 checkClassBinding!(typeof(this))(); 159 ptrcall!(void)(GDNativeClassBinding.setCollisionMask, _godot_object, collision_mask); 160 } 161 /** 162 163 */ 164 void setExclude(in Array exclude) 165 { 166 checkClassBinding!(typeof(this))(); 167 ptrcall!(void)(GDNativeClassBinding.setExclude, _godot_object, exclude); 168 } 169 /** 170 171 */ 172 void setMargin(in double margin) 173 { 174 checkClassBinding!(typeof(this))(); 175 ptrcall!(void)(GDNativeClassBinding.setMargin, _godot_object, margin); 176 } 177 /** 178 Sets the $(D Shape) that will be used for collision/intersection queries. 179 */ 180 void setShape(Resource shape) 181 { 182 checkClassBinding!(typeof(this))(); 183 ptrcall!(void)(GDNativeClassBinding.setShape, _godot_object, shape); 184 } 185 /** 186 187 */ 188 void setShapeRid(in RID shape) 189 { 190 checkClassBinding!(typeof(this))(); 191 ptrcall!(void)(GDNativeClassBinding.setShapeRid, _godot_object, shape); 192 } 193 /** 194 195 */ 196 void setTransform(in Transform transform) 197 { 198 checkClassBinding!(typeof(this))(); 199 ptrcall!(void)(GDNativeClassBinding.setTransform, _godot_object, transform); 200 } 201 /** 202 If `true`, the query will take $(D Area)s into account. 203 */ 204 @property bool collideWithAreas() 205 { 206 return isCollideWithAreasEnabled(); 207 } 208 /// ditto 209 @property void collideWithAreas(bool v) 210 { 211 setCollideWithAreas(v); 212 } 213 /** 214 If `true`, the query will take $(D PhysicsBody)s into account. 215 */ 216 @property bool collideWithBodies() 217 { 218 return isCollideWithBodiesEnabled(); 219 } 220 /// ditto 221 @property void collideWithBodies(bool v) 222 { 223 setCollideWithBodies(v); 224 } 225 /** 226 The physics layer(s) the query will take into account (as a bitmask). 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. 227 */ 228 @property long collisionMask() 229 { 230 return getCollisionMask(); 231 } 232 /// ditto 233 @property void collisionMask(long v) 234 { 235 setCollisionMask(v); 236 } 237 /** 238 The list of objects or object $(D RID)s that will be excluded from collisions. 239 */ 240 @property Array exclude() 241 { 242 return getExclude(); 243 } 244 /// ditto 245 @property void exclude(Array v) 246 { 247 setExclude(v); 248 } 249 /** 250 The collision margin for the shape. 251 */ 252 @property double margin() 253 { 254 return getMargin(); 255 } 256 /// ditto 257 @property void margin(double v) 258 { 259 setMargin(v); 260 } 261 /** 262 The queried shape's $(D RID). See also $(D setShape). 263 */ 264 @property RID shapeRid() 265 { 266 return getShapeRid(); 267 } 268 /// ditto 269 @property void shapeRid(RID v) 270 { 271 setShapeRid(v); 272 } 273 /** 274 The queried shape's transform matrix. 275 */ 276 @property Transform transform() 277 { 278 return getTransform(); 279 } 280 /// ditto 281 @property void transform(Transform v) 282 { 283 setTransform(v); 284 } 285 }