- Object
-
- Raycast
-
public class Raycast extends Object implements Shiftable, Copyable<Raycast>
Represents the result of aRay
cast against (intersecting with) aConvex
Shape
.The point is the point on the
Convex
Shape
where the ray intersects. The normal is the normal of the edge theRay
intersects.- Since:
- 2.0.0
- Version:
- 4.0.0
- Author:
- William Bittle
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clears this object setting all values to their default values.Raycast
copy()
Returns a deep copy of this object.void
copy(Raycast raycast)
double
getDistance()
Returns the distance from the start of theRay
to the hit point.Vector2
getNormal()
Returns the normal at the hit point.Vector2
getPoint()
Returns the hit point.void
setDistance(double distance)
Sets the distance from the start of theRay
to the hit point.void
setNormal(Vector2 normal)
Sets the normal at the hit point.void
setPoint(Vector2 point)
Sets the hit point.void
shift(Vector2 shift)
Translates the object to match the given coordinate shift.String
toString()
-
-
-
Method Detail
-
clear
public void clear()
Clears this object setting all values to their default values.
-
setPoint
public void setPoint(Vector2 point)
Sets the hit point.- Parameters:
point
- the hit point
-
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 theRay
to the hit point.- Returns:
- double
-
setDistance
public void setDistance(double distance)
Sets the distance from the start of theRay
to the hit point.- Parameters:
distance
- the distance
-
copy
public void copy(Raycast 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.
-
-