public Bullet(Model model,FirstPersonCamera cam) { shape = new Sprite3D(model); this.cam = cam; shape.setPosition(cam.getPosition()); shape.setScale(Consts.WORLDSCALE / 10f); float dx = cam.getLookAt().X - shape.getPosition().X; float dy = cam.getLookAt().Y - shape.getPosition().Y; float dz = cam.getLookAt().Z - shape.getPosition().Z; float d = (float)(Math.Sqrt(dx * dx + dy * dy + dz * dz)); this.velocity = new Vector3(dx / d * Consts.BULLETSPEED, dy / d * Consts.BULLETSPEED, dz / d * Consts.BULLETSPEED); }
public Bullet(Model model, FirstPersonCamera cam) { shape = new Sprite3D(model); this.cam = cam; shape.setPosition(cam.getPosition()); shape.setScale(Consts.WORLDSCALE / 10f); float dx = cam.getLookAt().X - shape.getPosition().X; float dy = cam.getLookAt().Y - shape.getPosition().Y; float dz = cam.getLookAt().Z - shape.getPosition().Z; float d = (float)(Math.Sqrt(dx * dx + dy * dy + dz * dz)); this.velocity = new Vector3(dx / d * Consts.BULLETSPEED, dy / d * Consts.BULLETSPEED, dz / d * Consts.BULLETSPEED); }
public bool collidesWithMap(Sprite3D spr) { foreach (Sprite3D block in Blocks) { if (spr.intersects(block)) { return(true); } } foreach (Image3D img in images) { if (img.getBoundingBox().Contains(spr.getBoundings()) != ContainmentType.Disjoint) { return(true); } } return(false); }
public bool collidesWithMap(Sprite3D spr) { foreach (Sprite3D block in Blocks) { if (spr.intersects(block)) { return true; } } foreach (Image3D img in images) { if (img.getBoundingBox().Contains(spr.getBoundings()) != ContainmentType.Disjoint) { return true; } } return false; }
public bool intersects(Sprite3D spr) { return(getBoundings().Contains(spr.getBoundings()) != ContainmentType.Disjoint); }
public bool intersects(Sprite3D spr) { return getBoundings().Contains(spr.getBoundings()) != ContainmentType.Disjoint; }