sorry for stupid question that im about to ask but dose vectors need tow dots but vec3 constructor only requires 1 dot(set of coordinates) and is called vector ?
also it works thanks!
boolean islookinatit(Player player,LivingEntity entity) {
Vec3 vec3 = player.getViewVector(1.0F).normalize();
Vec3 vec31 = new Vec3(entity.getX() - player.getX(), entity.getY() - player.getEyeY(), entity.getZ() - player.getZ());
double d0 = vec31.length();
vec31 = vec31.normalize();
double d1 = vec3.dot(vec31);
return d1 > 1.0D - 0.025D / d0 && AtoElineOfSight(player, entity);
}
public boolean AtoElineOfSight(Entity Ea,Entity Eb) {
if (Eb.level != Ea.level) {
return false;
} else {
Vec3 Avec = new Vec3(Ea.getX(), Ea.getEyeY(), Ea.getZ());
Vec3 Bvec = new Vec3(Eb.getX(), Eb.getY(), Eb.getZ());
if (Bvec.distanceTo(Avec) > 128.0D) {
return false;
} else {
return Ea.level.clip(new ClipContext(Avec, Bvec, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, Ea)).getType() == HitResult.Type.MISS;
}
}
}
but seems like im understood that im need it to collide not just with position of entity but with its boundingbox or hitbox of entity sorry for putting question so badly and also sorry for such a long delay with answer