Module org.dyn4j

Class Raycast

    • Field Detail

      • point

        protected final Vector2 point
        The hit point
      • normal

        protected final Vector2 normal
        The normal at the hit point
      • distance

        protected double distance
        The distance from the start of the Ray to the hit point
    • Constructor Detail

      • Raycast

        public Raycast()
        Default constructor.
      • Raycast

        protected Raycast​(Vector2 point,
                          Vector2 normal,
                          double distance)
        Full constructor.
        Parameters:
        point - the hit point
        normal - the normal at the hit point
        distance - the distance from the start of the Ray to the hit point
    • Method Detail

      • clear

        public void clear()
        Clears this object setting all values to their default values.
      • getPoint

        public Vector2 getPoint()
        Returns the hit point.
        Returns:
        Vector2
      • setPoint

        public void setPoint​(Vector2 point)
        Sets the hit point.
        Parameters:
        point - the hit point
      • getNormal

        public Vector2 getNormal()
        Returns the normal at the hit point.
        Returns:
        Vector2
      • setNormal

        public void setNormal​(Vector2 normal)
        Sets the normal at the hit point.
        Parameters:
        normal - the normal at the hit point
      • getDistance

        public double getDistance()
        Returns the distance from the start of the Ray to the hit point.
        Returns:
        double
      • setDistance

        public void setDistance​(double distance)
        Sets the distance from the start of the Ray to the hit point.
        Parameters:
        distance - the distance
      • copy

        public void copy​(Raycast raycast)
        Copies (deep) the given Raycast information to this Raycast.
        Parameters:
        raycast - the raycast to copy
        Since:
        4.0.0
      • shift

        public void shift​(Vector2 shift)
        Description copied from interface: Shiftable
        Translates the object to match the given coordinate shift.
        Specified by:
        shift in interface Shiftable
        Parameters:
        shift - the amount to shift along the x and y axes
      • copy

        public Raycast copy()
        Description copied from interface: Copyable
        Returns a deep copy of this object.
        Specified by:
        copy in interface Copyable<Raycast>
        Returns:
        T