Table of Contents

Class PhysicsRayQueryParameters2D

Namespace
Godot
Assembly
GodotSharp.dll

By changing various properties of this object, such as the ray position, you can configure the parameters for IntersectRay(PhysicsRayQueryParameters2D).

public class PhysicsRayQueryParameters2D : RefCounted, IDisposable
Inheritance
PhysicsRayQueryParameters2D
Implements
Inherited Members

Constructors

PhysicsRayQueryParameters2D()

public PhysicsRayQueryParameters2D()

Properties

CollideWithAreas

If true, the query will take Area2Ds into account.

public bool CollideWithAreas { get; set; }

Property Value

bool

CollideWithBodies

If true, the query will take PhysicsBody2Ds into account.

public bool CollideWithBodies { get; set; }

Property Value

bool

CollisionMask

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.

public uint CollisionMask { get; set; }

Property Value

uint

Exclude

The list of object Rids that will be excluded from collisions. Use 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.

public Array<Rid> Exclude { get; set; }

Property Value

Array<Rid>

From

The starting point of the ray being queried for, in global coordinates.

public Vector2 From { get; set; }

Property Value

Vector2

HitFromInside

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.

public bool HitFromInside { get; set; }

Property Value

bool

To

The ending point of the ray being queried for, in global coordinates.

public Vector2 To { get; set; }

Property Value

Vector2

Methods

Create(Vector2, Vector2, uint, Array<Rid>)

Returns a new, pre-configured PhysicsRayQueryParameters2D object. Use it to quickly create query parameters using the most common options.

var query = PhysicsRayQueryParameters2D.create(global_position, global_position + Vector2(0, 100))
  var collision = get_world_2d().direct_space_state.intersect_ray(query)
public static PhysicsRayQueryParameters2D Create(Vector2 from, Vector2 to, uint collisionMask = 4294967295, Array<Rid> exclude = null)

Parameters

from Vector2
to Vector2
collisionMask uint
exclude Array<Rid>

Returns

PhysicsRayQueryParameters2D

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool