diff --git a/src/main/java/cactusServer/entities/Object.java b/src/main/java/cactusServer/entities/Object.java index 1e37907..d283b34 100644 --- a/src/main/java/cactusServer/entities/Object.java +++ b/src/main/java/cactusServer/entities/Object.java @@ -13,16 +13,16 @@ private Angle angle; private Attribute attribute; private String model; - + @JSONHint(ignore = true) public static final int UNIQUE_ID_LENGTH = 12; private Object() { // JSONDecode���̌Ăяo���p } - + public Object(Position3D position, Velocity3D velocity, AngularVelocity3D angularVelocity, Angle angle, - Attribute attribute, String model) { + Attribute attribute, String model) { setPosition(position); setVelocity(velocity); setAngularVelocity(angularVelocity); @@ -30,7 +30,7 @@ setAttribute(attribute); setModel(model); } - + public Object(Position3D position, Velocity3D velocity, AngularVelocity3D angularVelocity, Angle angle, Depth3D depth, Attribute attribute, String model) { setPosition(position); @@ -85,7 +85,7 @@ public void setAngle(Angle angle) { this.angle = angle; } - + public void setDepth(Depth3D depth) { this.depth = depth; } @@ -126,17 +126,27 @@ public boolean isPerDesion(Object another) { Position3D ap = another.getPosition(); - if (position.getX() == ap.getX() && position.getY() == ap.getY() && position.getZ() == ap.getZ()) { - return true; + Depth3D ad = another.getDepth(); + if (position.getX() <= ap.getX() && position.getX() + depth.getDepthX() >= ap.getX() + ad.getDepthX()) { + if (position.getY() <= ap.getY() && position.getY() + depth.getDepthY() >= ap.getY() + ad.getDepthY()) { + if (position.getZ() <= ap.getZ() && position.getZ() + depth.getDepthZ() >= ap.getZ() + ad.getDepthZ()) { + return true; + } + } } return false; } - public boolean isPerDesion(Player another) { - Position3D ap = another.getPosition(); - if (position.getX() == ap.getX() && position.getY() == ap.getY() && position.getZ() == ap.getZ()) { - return true; - } - return false; - } +// public boolean isPerDesion(Player another) { +// Position3D ap = another.getPosition(); +// Depth3D ad = another.getDepth(); +// if (position.getX() <= ap.getX() && position.getX() + depth.getDepthX() >= ap.getX() + ad.getDepthX()) { +// if (position.getY() <= ap.getY() && position.getY() + depth.getDepthY() >= ap.getY() + ad.getDepthY()) { +// if (position.getZ() <= ap.getZ() && position.getZ() + depth.getDepthZ() >= ap.getZ() + ad.getDepthZ()) { +// return true; +// } +// } +// } +// return false; +// } } \ No newline at end of file