/** * Ray-cast the world for all fixtures and particles in the path of the ray. * Your callback controls whether you get the closest point, any point, or n-points. * The ray-cast ignores shapes that contain the starting point. * * @param callback a user implemented callback class * @param particleCallback the particle callback class * @param point1 the ray starting point * @param point2 the ray ending point */ public void raycast(RayCastCallback callback, ParticleRaycastCallback particleCallback, Vec2 point1, Vec2 point2) { raycast(callback, point1, point2); raycast(particleCallback, point1, point2); }
/** * Ray-cast the world for all fixtures and particles in the path of the ray. * Your callback controls whether you get the closest point, any point, or n-points. * The ray-cast ignores shapes that contain the starting point. * * @param callback a user implemented callback class * @param particleCallback the particle callback class * @param point1 the ray starting point * @param point2 the ray ending point */ public void raycast(RayCastCallback callback, ParticleRaycastCallback particleCallback, Vec2 point1, Vec2 point2) { raycast(callback, point1, point2); raycast(particleCallback, point1, point2); }
/** * Performs a ray cast from start point to end point. * * @param start start point * @param end end point * @return ray cast result */ public RaycastResult raycast(Point2D start, Point2D end) { raycastCallback.reset(); jboxWorld.raycast(raycastCallback, toPoint(start), toPoint(end)); Entity entity = null; Point2D point = null; if (raycastCallback.getFixture() != null) entity = raycastCallback.getFixture().getBody().getEntity(); if (raycastCallback.getPoint() != null) point = toPoint(raycastCallback.getPoint()); if (entity == null && point == null) return RaycastResult.NONE; return new RaycastResult(entity, point); }
/** * Performs a ray cast from start point to end point. * * @param start start point * @param end end point * @return ray cast result */ public RaycastResult raycast(Point2D start, Point2D end) { raycastCallback.reset(); jboxWorld.raycast(raycastCallback, toPoint(start), toPoint(end)); Entity entity = null; Point2D point = null; if (raycastCallback.getFixture() != null) entity = raycastCallback.getFixture().getBody().getEntity(); if (raycastCallback.getPoint() != null) point = toPoint(raycastCallback.getPoint()); if (entity == null && point == null) return RaycastResult.NONE; return new RaycastResult(entity, point); }