Browse Source

cleanup and comment

server-collision
FatBoy-DOTC 10 months ago
parent
commit
a94a400102
  1. 4
      src/engine/CollisionEngine/Mesh.java
  2. 9
      src/engine/db/handlers/dbBuildingHandler.java

4
src/engine/CollisionEngine/Mesh.java

@ -26,8 +26,10 @@ public class Mesh {
if(!this.BoundsCollides(line)) if(!this.BoundsCollides(line))
return false; return false;
boolean feetcollides = (charY + charHeight) < this.minY;
boolean headcollides = charY > this.maxY;
//check to see if the mesh collides between the characters feet and head locations //check to see if the mesh collides between the characters feet and head locations
if((charY + charHeight) < this.minY && charY > this.maxY){ if(feetcollides && headcollides){
return false; return false;
} }

9
src/engine/db/handlers/dbBuildingHandler.java

@ -19,9 +19,9 @@ import engine.math.Vector2f;
import engine.math.Vector3f; import engine.math.Vector3f;
import engine.math.Vector3fImmutable; import engine.math.Vector3fImmutable;
import engine.objects.*; import engine.objects.*;
import javafx.geometry.Bounds;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -30,7 +30,6 @@ import java.sql.SQLException;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
@ -881,7 +880,7 @@ public class dbBuildingHandler extends dbHandlerBase {
public void LOAD_MESH_DATA() { public void LOAD_MESH_DATA() {
try (Connection connection = DbManager.getConnection(); try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `new-static_mesh_triangles`")) { PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_mesh_triangles`")) {
ResultSet rs = preparedStatement.executeQuery(); ResultSet rs = preparedStatement.executeQuery();
BuildingManager.mesh_triangle_points = new HashMap<>(); BuildingManager.mesh_triangle_points = new HashMap<>();
@ -934,8 +933,10 @@ public class dbBuildingHandler extends dbHandlerBase {
float refX = Float.parseFloat(rs.getString("ref").split(";")[0]); float refX = Float.parseFloat(rs.getString("ref").split(";")[0]);
float refZ = Float.parseFloat(rs.getString("ref").split(";")[1]); float refZ = Float.parseFloat(rs.getString("ref").split(";")[1]);
//Bounds bound = new Bounds(endX,0,endZ,0,0,0);
Vector2f topLeft = new Vector2f(centerX - refX,centerZ + refZ); Vector2f topLeft = new Vector2f(centerX + refX,centerZ + refZ);
float width = Math.abs(endX-refX); float width = Math.abs(endX-refX);
float height = Math.abs(endZ-refZ); float height = Math.abs(endZ-refZ);
Rectangle2D boundRect = new Rectangle2D.Float(); Rectangle2D boundRect = new Rectangle2D.Float();

Loading…
Cancel
Save