rayIntersection

public synchronized double rayIntersection(Location eyeLocation, double maxDistance)

Checks if a ray from a player's eye location intersects with this OBB. Optimized version that minimizes object creation.

Return

The distance to the intersection point, or -1 if no intersection

Parameters

eyeLocation

The eye location of the player

maxDistance

The maximum distance to check


public synchronized double rayIntersection(double ox, double oy, double oz, double dx, double dy, double dz, double maxDistance)

Ray/segment intersection against this OBB from an explicit origin and direction. Identical slab math to the Location overload, exposed for swept projectile detection: testing the segment a fast projectile traversed between ticks (origin = last position, direction = normalized travel, maxDistance = distance moved) catches arrows that a single-sample AABB overlap test tunnels straight through.

Return

distance to the nearest intersection, or -1 if none within range

Parameters

ox

ray origin X (world space)

oy

ray origin Y (world space)

oz

ray origin Z (world space)

dx

ray direction X (should be unit length)

dy

ray direction Y (should be unit length)

dz

ray direction Z (should be unit length)

maxDistance

maximum distance along the ray to consider