i hope this works
This commit is contained in:
@@ -9,12 +9,14 @@
|
||||
|
||||
package engine.objects;
|
||||
|
||||
import engine.InterestManagement.Terrain;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.math.Bounds;
|
||||
import engine.math.FastMath;
|
||||
import engine.math.Vector3f;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mobileAI.utilities.PathingUtilities;
|
||||
import engine.server.MBServerStatics;
|
||||
|
||||
import java.awt.*;
|
||||
@@ -287,6 +289,22 @@ public class Regions {
|
||||
}
|
||||
return region;
|
||||
}
|
||||
public static Regions getRegionAtPoint(PathingUtilities.Point point) {
|
||||
Vector3fImmutable baseLoc = new Vector3fImmutable(point.x,0,point.y);
|
||||
baseLoc.setY(Terrain.getWorldHeight(baseLoc));
|
||||
Building building = BuildingManager.getBuildingAtLocation(baseLoc);
|
||||
if(building == null)
|
||||
return null;
|
||||
for(Regions region : building.getBounds().getRegions())
|
||||
if(region.isPointInPolygon(baseLoc))
|
||||
return region;
|
||||
return null;
|
||||
}
|
||||
|
||||
public float getHeightAtPoint(PathingUtilities.Point point){
|
||||
Vector3fImmutable baseLoc = new Vector3fImmutable(point.x,0,point.y);
|
||||
return this.lerpY(baseLoc);
|
||||
}
|
||||
|
||||
public int getRoom() {
|
||||
return room;
|
||||
|
||||
Reference in New Issue
Block a user