/** * Constructor instantiates a new <code>Ray</code> object. The origin and * direction are given. * @param origin the origin of the ray. * @param direction the direction the ray travels in. */ public Ray(Vector3f origin, Vector3f direction) { setOrigin(origin); setDirection(direction); }
private static CollisionResults pick(Camera cam, Vector2f mouseLoc, Node node) { CollisionResults results = new CollisionResults(); Ray ray = new Ray(); Vector3f pos = new Vector3f(mouseLoc.x, mouseLoc.y, -1); Vector3f dir = new Vector3f(mouseLoc.x, mouseLoc.y, 1); dir.subtractLocal(pos).normalizeLocal(); ray.setOrigin(pos); ray.setDirection(dir); node.collideWith(ray, results); return results; } }
/** * Constructor instantiates a new <code>Ray</code> object. The origin and * direction are given. * @param origin the origin of the ray. * @param direction the direction the ray travels in. */ public Ray(Vector3f origin, Vector3f direction) { setOrigin(origin); setDirection(direction); }
/** * Constructor instantiates a new <code>Ray</code> object. The origin and * direction are given. * @param origin the origin of the ray. * @param direction the direction the ray travels in. */ public Ray(Vector3f origin, Vector3f direction) { setOrigin(origin); setDirection(direction); }
rot.multLocal(rayDir); ray.setDirection(rayDir); collisionResults.clear();
r.setOrigin(new Vector3f(inputRay.start.x, 0.5f, inputRay.start.y)); Vector2 v = inputRay.end.sub(inputRay.start); r.setDirection(new Vector3f(v.x, 0, v.y)); CollisionResults result = new CollisionResults();
ray.setDirection(sceneCam.getDirection()); ray.setDirection(ray.getDirection().negateLocal()); ray.intersectsWherePlane(plane, targetLocation); inv = true;
ray.setDirection(sceneCam.getDirection()); plane = new Plane(Vector3f.UNIT_Y, new Vector3f(0, waterHeight, 0).dot(Vector3f.UNIT_Y)); reflectionProcessor.setReflectionClipPlane(plane); boolean inv = false; if (!ray.intersectsWherePlane(plane, targetLocation)) { ray.setDirection(ray.getDirection().negateLocal()); ray.intersectsWherePlane(plane, targetLocation); inv = true;