IntersectRayResult
Result from intersecting a ray
PhysicsDirectSpaceState2D+IntersectRayResult.swift:25struct IntersectRayResult<T> where T : Object
Other members in extension
View members
Hide members
This section is hidden by default because it contains too many (8) members.
Type members
Instance members
func castMotion(parameters: PhysicsShapeQueryParameters2D?
) -> PackedFloat32Array Checks how far a
Shape2D
can move without colliding. All the parameters for the query, including the shape and the motion, are supplied through aPhysicsShapeQueryParameters2D
object.func collideShape(parameters: PhysicsShapeQueryParameters2D?, maxResults: Int32
) -> VariantCollection<Vector2> Checks the intersections of a shape, given through a
PhysicsShapeQueryParameters2D
object, against the space. The resulting array contains a list of points where the shape intersects another. Like withintersectShape(parameters:maxResults:)
, the number of returned results can be limited to save processing time.func getRestInfo(parameters: PhysicsShapeQueryParameters2D?
) -> GDictionary Checks the intersections of a shape, given through a
PhysicsShapeQueryParameters2D
object, against the space. If it collides with more than one shape, the nearest one is selected. If the shape did not intersect anything, then an empty dictionary is returned instead.func intersectPoint(parameters: PhysicsPointQueryParameters2D?, maxResults: Int32
) -> VariantCollection<GDictionary> Checks whether a point is inside any solid shape. Position and other parameters are defined through
PhysicsPointQueryParameters2D
. The shapes the point is inside of are returned in an array containing dictionaries with the following fields:func intersectRay<T>(T.Type, parameters: PhysicsRayQueryParameters2D
) -> IntersectRayResult<T>? Intersects a ray in a given space. Ray position and other parameters are defined through
PhysicsRayQueryParameters2D
The return value is anIntersectRayResult<T>?
whereT
is any GodotObject
, however if the ray did not intersect anything, or the intersecting collider was not of typeT
then a nil object is returned instead. UsuallyT
is a physics object such asStaticBody
for example but it could also be aGridMap
if themesh_library
has collisions.func intersectRay(parameters: PhysicsRayQueryParameters2D?
) -> GDictionary Intersects a ray in a given space. Ray position and other parameters are defined through
PhysicsRayQueryParameters2D
. The returned object is a dictionary with the following fields:func intersectShape(parameters: PhysicsShapeQueryParameters2D?, maxResults: Int32
) -> VariantCollection<GDictionary> Checks the intersections of a shape, given through a
PhysicsShapeQueryParameters2D
object, against the space. The intersected shapes are returned in an array containing dictionaries with the following fields:
Citizens in SwiftGodot
Instance members
let collider: T
The colliding object
let colliderId: Int
The colliding object’s ID.
let metadata: Variant?
The metadata value from the dictionary.
let normal: Vector2
The object’s surface normal at the intersection point, or
Vector2(x: 0, y: 0)
if the ray starts inside the shape andPhysicsRayQueryParameters2D.hitFromInside
is true.let position: Vector2
The intersection point
let rid: RID
The The intersecting object’s
RID
.let shape: Int
The shape index of the colliding shape.