RayCast2D

    A ray in 2D space, used to find the first CollisionObject2D it intersects.

    RayCast2D.swift:24
    class RayCast2D

    A raycast represents a ray from its origin to its targetPosition that finds the closest CollisionObject2D along its path, if it intersects any.

    RayCast2D can ignore some objects by adding them to an exception list, by making its detection reporting ignore Area2Ds (collideWithAreas) or PhysicsBody2Ds (collideWithBodies), or by configuring physics layers.

    RayCast2D calculates intersection every physics frame, and it holds the result until the next physics frame. For an immediate raycast, or if you want to configure a RayCast2D multiple times within the same physics frame, use forceRaycastUpdate.

    To sweep over a region of 2D space, you can approximate the region with multiple RayCast2Ds or use ShapeCast2D.

    Superclasses

    • class Node2D

      A 2D game object, inherited by all 2D-related nodes. Has a position, rotation, scale, and Z index.

    Citizens in SwiftGodot

    Conformances

    • protocol CustomStringConvertible

      A type with a customized textual representation.

    • protocol Equatable

      A type that can be compared for value equality.

    • protocol Hashable

      A type that can be hashed into a Hasher to produce an integer hash value.

    • protocol Identifiable<ID>

      A class of types whose instances hold the value of an entity with stable identity.

    • protocol VariantRepresentable

      Types that conform to VariantRepresentable can be stored directly in Variant with no conversion. These include all of the Variant types from Godot (for example GString, Rect, Plane), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.

    • protocol VariantStorable

      Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.

    Type members

    Instance members