Ray

class Ray(startPoint: Vec2, direction: Vec2, distance: Double)

Ray class to define and project rays in a world.

Parameters

startPoint

The origin of the rays projection.

direction

The direction of the ray points in radians.

distance

The distance the ray is projected

Constructors

Link copied to clipboard
fun Ray(direction: Double, distance: Double)

Convenience constructor with ray set at origin. Similar to .Ray

Link copied to clipboard
fun Ray(direction: Vec2, distance: Double)

Convenience constructor with ray set at origin. Similar to .Ray

Link copied to clipboard
fun Ray(startPoint: Vec2, direction: Double, distance: Double)

Convenience constructor. Similar to .Ray

Link copied to clipboard
fun Ray(startPoint: Vec2, direction: Vec2, distance: Double)

Functions

Link copied to clipboard
fun updateProjection(bodiesToEvaluate: ArrayList<TranslatableBody>)

Updates the projection in world space and acquires information about the closest intersecting object with the ray projection.

Properties

Link copied to clipboard
var direction: Vec2

Gets the direction of the ray in radians.

Link copied to clipboard
val distance: Double
Link copied to clipboard
var rayInformation: RayInformation? = null
Link copied to clipboard
var startPoint: Vec2