PhysicsRayQueryParameters2D
Parameters for a one-shot 2D ray query.
From and To are world endpoints of one segment. CollisionMask filters candidate Layers; CollideWithBodies/CollideWithAreas choose categories. Exclude holds physics-object RIDs, not instance IDs.
Parameters are not automatically inherited from a camera/weapon. Validate finite coordinates, a positive distance when computing endpoints and the intended world. Account for HitFromInside and geometry limitations separately; backface detection does not fill a concave surface.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
PhysicsRayQueryParameters2DConstructor
public PhysicsRayQueryParameters2D();Properties7
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; }Physics-object RIDs excluded from the query. Obtain them with CollisionObject.GetRid; GetInstanceId and visual mesh references are not those RIDs.
FromProperty
public Vector2 From { get; set; }The starting point of the ray being queried for, in global coordinates.
HitFromInsideProperty
public bool HitFromInside { get; set; }If true, the query will detect a hit when starting inside shapes. In this case the collision normal will be Vector2(0, 0). Does not affect concave polygon shapes.
ToProperty
public Vector2 To { get; set; }The ending point of the ray being queried for, in global coordinates.
Methods15
CreatePhysicsRayQueryParameters2D
public static PhysicsRayQueryParameters2D Create(Vector2 from, Vector2 to, uint collisionMask = 4294967295, Reckfell.Collections.Array<Rid> exclude = null);Returns a new, pre-configured PhysicsRayQueryParameters2D object. Use it to quickly create query parameters using the most common options.
| Name | Type | Default |
|---|---|---|
from | Vector2 | — |
to | Vector2 | — |
collisionMask | uint | 4294967295 |
exclude | Reckfell.Collections.Array<Rid> | null |
PhysicsRayQueryParameters2DGetCollisionMaskuint
public uint GetCollisionMask();uintGetExcludeReckfell.Collections.Array<Rid>
public Reckfell.Collections.Array<Rid> GetExclude();Reckfell.Collections.Array<Rid>GetFromVector2
public Vector2 GetFrom();Vector2GetToVector2
public Vector2 GetTo();Vector2IsCollideWithAreasEnabledbool
public bool IsCollideWithAreasEnabled();boolIsCollideWithBodiesEnabledbool
public bool IsCollideWithBodiesEnabled();boolIsHitFromInsideEnabledbool
public bool IsHitFromInsideEnabled();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> | — |
SetFromvoid
public void SetFrom(Vector2 from);| Name | Type | Default |
|---|---|---|
from | Vector2 | — |
SetHitFromInsidevoid
public void SetHitFromInside(bool enable);| Name | Type | Default |
|---|---|---|
enable | bool | — |
SetTovoid
public void SetTo(Vector2 to);| Name | Type | Default |
|---|---|---|
to | Vector2 | — |