Package com.badlogic.gdx.math.collision
Class Ray
- java.lang.Object
-
- com.badlogic.gdx.math.collision.Ray
-
- All Implemented Interfaces:
java.io.Serializable
public class Ray extends java.lang.Object implements java.io.SerializableEncapsulates a ray having a starting position and a unit length direction.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Raycpy()booleanequals(java.lang.Object o)Vector3getEndPoint(Vector3 out, float distance)Returns the endpoint given the distance.inthashCode()Raymul(Matrix4 matrix)Multiplies the ray by the given matrix.Rayset(float x, float y, float z, float dx, float dy, float dz)Sets this ray from the given starting position and direction.Rayset(Ray ray)Sets the starting position and direction from the given rayRayset(Vector3 origin, Vector3 direction)Sets the starting position and the direction of this ray.java.lang.StringtoString()
-
-
-
Method Detail
-
cpy
public Ray cpy()
- Returns:
- a copy of this ray.
-
getEndPoint
public Vector3 getEndPoint(Vector3 out, float distance)
Returns the endpoint given the distance. This is calculated as startpoint + distance * direction.- Parameters:
out- The vector to set to the resultdistance- The distance from the end point to the start point.- Returns:
- The out param
-
mul
public Ray mul(Matrix4 matrix)
Multiplies the ray by the given matrix. Use this to transform a ray into another coordinate system.- Parameters:
matrix- The matrix- Returns:
- This ray for chaining.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
set
public Ray set(Vector3 origin, Vector3 direction)
Sets the starting position and the direction of this ray.- Parameters:
origin- The starting positiondirection- The direction- Returns:
- this ray for chaining
-
set
public Ray set(float x, float y, float z, float dx, float dy, float dz)
Sets this ray from the given starting position and direction.- Parameters:
x- The x-component of the starting positiony- The y-component of the starting positionz- The z-component of the starting positiondx- The x-component of the directiondy- The y-component of the directiondz- The z-component of the direction- Returns:
- this ray for chaining
-
set
public Ray set(Ray ray)
Sets the starting position and direction from the given ray- Parameters:
ray- The ray- Returns:
- This ray for chaining
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-