Click or drag to resize

PhysicsDirectSpaceStateIntersectRay Method

Intersects a ray in a given space. The returned object is a dictionary with the following fields:

collider: The colliding object.

collider_id: The colliding object's ID.

normal: The object's surface normal at the intersection point.

position: The intersection point.

rid: The intersecting object's RID.

shape: The shape index of the colliding shape.

If the ray did not intersect anything, then an empty dictionary is returned instead.

Additionally, the method can take an exclude array of objects or RIDs that are to be excluded from collisions, a collision_mask bitmask representing the physics layers to check in, or booleans to determine if the ray should collide with PhysicsBodys or Areas, respectively.

Namespace:  Godot
Assembly:  GodotSharp (in GodotSharp.dll) Version: 1.0.0
Syntax
C#
public Dictionary IntersectRay(
	Vector3 from,
	Vector3 to,
	Array exclude = null,
	uint collisionMask = 2147483647,
	bool collideWithBodies = true,
	bool collideWithAreas = false
)

Parameters

from
Type: GodotVector3

[Missing <param name="from"/> documentation for "M:Godot.PhysicsDirectSpaceState.IntersectRay(Godot.Vector3,Godot.Vector3,Godot.Collections.Array,System.UInt32,System.Boolean,System.Boolean)"]

to
Type: GodotVector3

[Missing <param name="to"/> documentation for "M:Godot.PhysicsDirectSpaceState.IntersectRay(Godot.Vector3,Godot.Vector3,Godot.Collections.Array,System.UInt32,System.Boolean,System.Boolean)"]

exclude (Optional)
Type: Godot.CollectionsArray
If the parameter is null, then the default value is new Godot.Collections.Array {}
collisionMask (Optional)
Type: SystemUInt32

[Missing <param name="collisionMask"/> documentation for "M:Godot.PhysicsDirectSpaceState.IntersectRay(Godot.Vector3,Godot.Vector3,Godot.Collections.Array,System.UInt32,System.Boolean,System.Boolean)"]

collideWithBodies (Optional)
Type: SystemBoolean

[Missing <param name="collideWithBodies"/> documentation for "M:Godot.PhysicsDirectSpaceState.IntersectRay(Godot.Vector3,Godot.Vector3,Godot.Collections.Array,System.UInt32,System.Boolean,System.Boolean)"]

collideWithAreas (Optional)
Type: SystemBoolean

[Missing <param name="collideWithAreas"/> documentation for "M:Godot.PhysicsDirectSpaceState.IntersectRay(Godot.Vector3,Godot.Vector3,Godot.Collections.Array,System.UInt32,System.Boolean,System.Boolean)"]

Return Value

Type: Dictionary

[Missing <returns> documentation for "M:Godot.PhysicsDirectSpaceState.IntersectRay(Godot.Vector3,Godot.Vector3,Godot.Collections.Array,System.UInt32,System.Boolean,System.Boolean)"]

See Also