package speiger.src.coreengine.rendering.inputOld.raycast;

import speiger.src.coreengine.math.vector.floats.Vec3f;

public class RayResult
{
	Ray ray;
	Vec3f hit;
	double distance;
	public Object subData;
	
	public RayResult(Ray ray, Vec3f hit, double distance)
	{
		this.ray = ray;
		this.hit = hit;
		this.distance = distance;
	}
	
	public double getDistance()
	{
		return distance;
	}
	
	public Vec3f getHit()
	{
		return hit;
	}
	
	public Ray getRay()
	{
		return ray;
	}
	
	public <T> T getSubData(Class<T> clz)
	{
		return subData != null && clz.isInstance(subData) ? clz.cast(subData) : null;
	}
}
