PhysicsShapeQueryParameters2D
Provides parameters for PhysicsDirectSpaceState2D's methods.
Provides parameters for PhysicsDirectSpaceState2D's methods.
By changing various properties of this object, such as the shape, you can configure the parameters for PhysicsDirectSpaceState2D's methods.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
PhysicsShapeQueryParameters2DConstructor
public PhysicsShapeQueryParameters2D();Properties9
CollideWithAreasProperty
public bool CollideWithAreas { get; set; }If true, the query will take Area2Ds into account.
CollideWithBodiesProperty
public bool CollideWithBodies { get; set; }If true, the query will take PhysicsBody2Ds into account.
CollisionMaskProperty
public uint CollisionMask { get; set; }The physics layers the query will detect (as a bitmask). By default, all collision layers are detected. See Collision layers and masks in the documentation for more information.
ExcludeProperty
public Reckfell.Collections.Array<Rid> Exclude { get; set; }The list of object Rids that will be excluded from collisions. Use CollisionObject2D.GetRid to get the Rid associated with a CollisionObject2D-derived node.
Note: The returned array is copied and any changes to it will not update the original property value. To update the value you need to modify the returned array, and then assign it to the property again.
MarginProperty
public float Margin { get; set; }The collision margin for the shape.
MotionProperty
public Vector2 Motion { get; set; }The motion of the shape being queried for.
ShapeProperty
public Resource Shape { get; set; }The Shape2D that will be used for collision/intersection queries. This stores the actual reference which avoids the shape to be released while being used for queries, so always prefer using this over PhysicsShapeQueryParameters2D.ShapeRid.
ShapeRidProperty
public Rid ShapeRid { get; set; }The queried shape's Rid that will be used for collision/intersection queries. Use this over PhysicsShapeQueryParameters2D.Shape if you want to optimize for performance using the Servers API:
RID shapeRid = PhysicsServer2D.CircleShapeCreate();
int radius = 64;
PhysicsServer2D.ShapeSetData(shapeRid, radius);
var params = new PhysicsShapeQueryParameters2D();
params.ShapeRid = shapeRid;
// Execute physics queries here...
// Release the shape when done with physics queries.
PhysicsServer2D.FreeRid(shapeRid);TransformProperty
public Transform2D Transform { get; set; }The queried shape's transform matrix.
Methods18
GetCollisionMaskuint
public uint GetCollisionMask();uintGetExcludeReckfell.Collections.Array<Rid>
public Reckfell.Collections.Array<Rid> GetExclude();Reckfell.Collections.Array<Rid>GetMarginfloat
public float GetMargin();floatGetMotionVector2
public Vector2 GetMotion();Vector2GetShapeResource
public Resource GetShape();ResourceGetShapeRidRid
public Rid GetShapeRid();RidGetTransformTransform2D
public Transform2D GetTransform();Transform2DIsCollideWithAreasEnabledbool
public bool IsCollideWithAreasEnabled();boolIsCollideWithBodiesEnabledbool
public bool IsCollideWithBodiesEnabled();boolSetCollideWithAreasvoid
public void SetCollideWithAreas(bool enable);| Name | Type | Default |
|---|---|---|
enable | bool | — |
SetCollideWithBodiesvoid
public void SetCollideWithBodies(bool enable);| Name | Type | Default |
|---|---|---|
enable | bool | — |
SetCollisionMaskvoid
public void SetCollisionMask(uint collisionMask);| Name | Type | Default |
|---|---|---|
collisionMask | uint | — |
SetExcludevoid
public void SetExclude(Reckfell.Collections.Array<Rid> exclude);| Name | Type | Default |
|---|---|---|
exclude | Reckfell.Collections.Array<Rid> | — |
SetMarginvoid
public void SetMargin(float margin);| Name | Type | Default |
|---|---|---|
margin | float | — |
SetMotionvoid
public void SetMotion(Vector2 motion);| Name | Type | Default |
|---|---|---|
motion | Vector2 | — |
SetShapevoid
public void SetShape(Resource shape);| Name | Type | Default |
|---|---|---|
shape | Resource | — |
SetShapeRidvoid
public void SetShapeRid(Rid shape);| Name | Type | Default |
|---|---|---|
shape | Rid | — |
SetTransformvoid
public void SetTransform(Transform2D transform);| Name | Type | Default |
|---|---|---|
transform | Transform2D | — |