Module org.dyn4j

Class RaycastResult

  • All Implemented Interfaces:
    java.lang.Comparable<RaycastResult>

    public class RaycastResult
    extends java.lang.Object
    implements java.lang.Comparable<RaycastResult>
    Represents the result of a raycast.

    Implements the Comparable interface to allow for sorting by the distance.

    Note: this class has a natural ordering that is inconsistent with equals.

    Since:
    2.0.0
    Version:
    3.2.0
    Author:
    William Bittle
    • Constructor Detail

      • RaycastResult

        public RaycastResult()
        Default constructor.
      • RaycastResult

        public RaycastResult​(Body body,
                             BodyFixture fixture,
                             Raycast raycast)
        Full constructor.
        Parameters:
        body - the body
        fixture - the fixture
        raycast - the raycast
    • Method Detail

      • compareTo

        public int compareTo​(RaycastResult o)
        Specified by:
        compareTo in interface java.lang.Comparable<RaycastResult>
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getBody

        public Body getBody()
        Returns the Body detected.
        Returns:
        Body
      • setBody

        public void setBody​(Body body)
        Sets the Body detected.
        Parameters:
        body - the Body
      • setRaycast

        public void setRaycast​(Raycast raycast)
        Sets the Raycast result information.
        Parameters:
        raycast - the Raycast