public class Point extends AbstractPosition
map, SQRT12, SQRT2
Constructor and Description |
---|
Point(AbstractMap map,
float posX,
float posY,
float height)
Creates a point refering to a position in the game world.
|
Point(Point point)
Copy-constructor.
|
Modifier and Type | Method and Description |
---|---|
Point |
addVector(float[] vector)
Add a vector to the position
|
Point |
addVector(float x,
float y,
float z)
Add a vector to the position.
|
Point |
addVector(com.badlogic.gdx.math.Vector2 vector)
Add a vector to the position
|
Point |
addVector(com.badlogic.gdx.math.Vector3 vector)
Add a vector to the position
|
Point |
cpy() |
float |
distanceTo(AbstractGameObject object) |
float |
distanceTo(Point point) |
float |
distanceToHorizontal(AbstractGameObject object)
checks only x and y.
|
float |
distanceToHorizontal(Point point)
checks only x and y.
|
boolean |
equals(java.lang.Object obj) |
CoreData |
getBlock()
Clamps positions over the map at topmost layer.
|
Coordinate |
getCoord()
returns coordinate aquivalent.
|
java.util.ArrayList<AbstractEntity> |
getEntitiesNearby(float radius)
get entities in radius
|
<type> java.util.ArrayList<type> |
getEntitiesNearby(float radius,
java.lang.Class<? extends AbstractEntity> type)
get entities in radius
|
java.util.ArrayList<AbstractEntity> |
getEntitiesNearbyHorizontal(float radius)
get entities in radius (horizontal only)
|
<type> java.util.ArrayList<type> |
getEntitiesNearbyHorizontal(float radius,
java.lang.Class<type> type)
get entities in horizontal radius (like a pipe)
|
Point |
getPoint()
Returns itself.
|
com.badlogic.gdx.math.Vector3 |
getRelToCoord() |
float |
getRelToCoordX() |
float |
getRelToCoordY() |
float |
getRelToCoordZ() |
com.badlogic.gdx.math.Vector3 |
getVector()
Get as array triple
|
int |
getViewSpcX(GameView view)
Calculate position in view space.
|
int |
getViewSpcY(GameView view)
Calculate position in view space.
|
float |
getX()
Get the game world position from left
|
float |
getY()
Get the game world position from top.
|
float |
getZ()
Get the height (z-value) of the coordinate.
|
float |
getZGrid()
Get the z in grid coordinates of the coordinate.
|
int |
hashCode() |
boolean |
isInMemoryArea()
Checks if the position is on the chunks currently in memory.
|
boolean |
isInMemoryAreaHorizontal()
Checks if the position is on the chunks currently in memory.
|
Intersection |
raycast(com.badlogic.gdx.math.Vector3 direction,
float radius,
Camera camera,
boolean onlySolid)
Trace a ray through the map until ray hits non air block.
|
void |
setPositionRelativeToCoord(float x,
float y,
float z)
Relative to the current coordiante field set the offset.
|
void |
setZ(float height) |
java.lang.String |
toString() |
getDepth, getMap
public Point(AbstractMap map, float posX, float posY, float height)
map
- posX
- The distance from the left border of the map (game space)posY
- The distance from the top border of the map (game space)height
- The distance from ground (game space)public Point(Point point)
point
- the source of the copypublic Point getPoint()
getPoint
in class AbstractPosition
public float getZ()
public float getZGrid()
public void setZ(float height)
height
- public Coordinate getCoord()
getCoord
in class AbstractPosition
public float getX()
public float getY()
public com.badlogic.gdx.math.Vector3 getVector()
getVector
in class AbstractPosition
public float getRelToCoordX()
public float getRelToCoordY()
public float getRelToCoordZ()
public com.badlogic.gdx.math.Vector3 getRelToCoord()
public CoreData getBlock()
AbstractPosition
getBlock
in class AbstractPosition
#getBlockSafe()
public Point cpy()
cpy
in class AbstractPosition
public int getViewSpcX(GameView view)
AbstractPosition
getViewSpcX
in class AbstractPosition
public int getViewSpcY(GameView view)
AbstractPosition
getViewSpcY
in class AbstractPosition
public boolean isInMemoryAreaHorizontal()
AbstractPosition
isInMemoryAreaHorizontal
in class AbstractPosition
public boolean isInMemoryArea()
AbstractPosition
isInMemoryArea
in class AbstractPosition
public Point addVector(float[] vector)
addVector
in class AbstractPosition
vector
- all values in game world valuespublic Point addVector(com.badlogic.gdx.math.Vector2 vector)
vector
- all values in game world valuespublic Point addVector(com.badlogic.gdx.math.Vector3 vector)
addVector
in class AbstractPosition
vector
- all values in game world valuespublic Point addVector(float x, float y, float z)
AbstractPosition
addVector
in class AbstractPosition
x
- x value to addy
- y value to addz
- height to addpublic void setPositionRelativeToCoord(float x, float y, float z)
x
- offset from originy
- offset from originz
- offset from originpublic Intersection raycast(com.badlogic.gdx.math.Vector3 direction, float radius, Camera camera, boolean onlySolid)
direction
- direction of the rayradius
- the distane after which it should stop.camera
- if set only intersect with blocks which are rendered (not clipped). ignoring clipping if nullonlySolid
- only intersect if true with block which are not transparent =solidpublic float distanceTo(Point point)
point
- public float distanceTo(AbstractGameObject object)
object
- public float distanceToHorizontal(Point point)
point
- public float distanceToHorizontal(AbstractGameObject object)
object
- public java.util.ArrayList<AbstractEntity> getEntitiesNearby(float radius)
radius
- in game dimension pixelspublic <type> java.util.ArrayList<type> getEntitiesNearby(float radius, java.lang.Class<? extends AbstractEntity> type)
type
- returns only object if type which is the filterradius
- in game dimension pixelstype
- the type you want to filterpublic java.util.ArrayList<AbstractEntity> getEntitiesNearbyHorizontal(float radius)
radius
- in game dimension pixelspublic <type> java.util.ArrayList<type> getEntitiesNearbyHorizontal(float radius, java.lang.Class<type> type)
type
- radius
- in game dimension pixelstype
- public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object