mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-07-31 01:15:57 -04:00
Check for vector norm of 0
This commit is contained in:
@@ -982,6 +982,13 @@ public class SimulationService implements INetworkDispatch {
|
||||
Point3D end = new Point3D(position2.x, position2.y + 1, position2.z);
|
||||
|
||||
Vector3D direction = new Vector3D(end.x - origin.x, end.y - origin.y, end.z - origin.z).normalize();
|
||||
|
||||
if (direction.getNorm() != 0) {
|
||||
direction.normalize();
|
||||
} else {
|
||||
System.out.println("WARNING: checkLineOfSightInBuilding: Vector norm was 0.");
|
||||
}
|
||||
|
||||
float distance = position1.getDistance2D(position2);
|
||||
Ray ray = new Ray(origin, direction);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user