// LOS test, assumes all entities are see-through
WorldCollision col;
- if (world.Intersection(aim, glm::mat4(1.0f), reference, col) && col.depth < dist) {
+ if (world.Intersection(aim, reference, col) && col.depth < dist) {
continue;
}
return false;
}
WorldCollision col;
- if (world.Intersection(aim, glm::mat4(1.0f), reference, col) && col.depth < dist) {
+ if (world.Intersection(aim, reference, col) && col.depth < dist) {
return false;
}
return true;
for (WorldCollision &c : col) {
// diff points from block to state
glm::vec3 diff = state.RelativePosition(c.ChunkPos()) - c.BlockCoords();
- float dist = length_squared(diff);
+ float dist = length2(diff);
if (dist < distance) {
nearest = &c;
difference = diff;
return;
}
// halt if we're close enough, flee if we're too close
- float dist_sq = length_squared(e.AbsoluteDifference(ctrl.GetPursuitTarget()));
+ float dist_sq = length2(e.AbsoluteDifference(ctrl.GetPursuitTarget()));
if (dist_sq < 8.0f) {
ctrl.SetFleeTarget(ctrl.GetPursuitTarget());
ctrl.SetState(flee);