/** Quick check whether the given {@link Ray} and {@link BoundingBox} intersect. * * @param ray The ray * @param box The bounding box * @return Whether the ray and the bounding box intersect. */ static public boolean intersectRayBoundsFast (Ray ray, BoundingBox box) { return intersectRayBoundsFast(ray, box.getCenter(tmp1), box.getDimensions(tmp2)); }
/** Quick check whether the given {@link Ray} and {@link BoundingBox} intersect. * * @param ray The ray * @param box The bounding box * @return Whether the ray and the bounding box intersect. */ static public boolean intersectRayBoundsFast (Ray ray, BoundingBox box) { return intersectRayBoundsFast(ray, box.getCenter(tmp1), box.getDimensions(tmp2)); }
/** Quick check whether the given {@link Ray} and {@link BoundingBox} intersect. * * @param ray The ray * @param box The bounding box * @return Whether the ray and the bounding box intersect. */ static public boolean intersectRayBoundsFast (Ray ray, BoundingBox box) { return intersectRayBoundsFast(ray, box.getCenter(tmp1), box.getDimensions(tmp2)); }
public void processDragPan(Ray dragCurrentRay, Ray lastDragProcessedRay) { followTarget = null; // TODO: // Can probably be optimized, but simply storing worldDragLast.set(worldDragCurrent) // caused jitter for some reason. Intersector.intersectRayPlane(dragCurrentRay, worldGroundPlane, worldDragCurrent); Intersector.intersectRayPlane(lastDragProcessedRay, worldGroundPlane, worldDragLast); tmp1.set(worldDragLast).sub(worldDragCurrent); tmp1.y = 0; ray.origin.set(camera.targetPosition).add(tmp1); ray.direction.set(camera.targetDirection); if (Intersector.intersectRayBoundsFast(ray, worldBoundingBox)) { camera.targetPosition.add(tmp1); worldGroundTarget.add(tmp1); } }
public void processKeyboardPan(Vector2 keysMoveDirection, float deltaTime) { followTarget = null; tmp1.set(camera.targetDirection).crs(camera.targetUp).scl(keysMoveDirection.x); tmp1.add(tmp2.set(camera.targetDirection).scl(keysMoveDirection.y)); tmp1.y = 0; tmp1.nor().scl(deltaTime * GameSettings.CAMERA_MAX_PAN_VELOCITY); ray.origin.set(camera.targetPosition).add(tmp1); ray.direction.set(camera.targetDirection); if (Intersector.intersectRayBoundsFast(ray, worldBoundingBox)) { camera.targetPosition.add(tmp1); worldGroundTarget.add(tmp1); } }