public class Point extends AbstractPosition
SQRT12, SQRT2
Constructor and Description |
---|
Point(float posX,
float posY,
float height,
boolean relative)
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) |
Point |
addVector(com.badlogic.gdx.math.Vector3 vector)
Add a vector to the position
|
Point |
cpy() |
float |
distanceTo(Point point) |
float[] |
getAbs() |
float |
getAbsX() |
float |
getAbsY() |
Block |
getBlock() |
Block |
getBlockClamp() |
Block |
getBlockSafe()
Get the block at the position.
|
Coordinate |
getCoord()
returns coordinate aquivalent.
|
int |
getDepth()
Returns the depth of the object.
|
Point |
getPoint()
Returns itself.
|
int |
getProjectedPosX()
Calculate projected position.
|
int |
getProjectedPosY()
Calculate projected position.
|
float[] |
getRel() |
float |
getRelX()
Get the game world position from left
|
float |
getRelY()
Get the game world position from top.
|
boolean |
onLoadedMap()
Checks if the position is on the chunks currently in memory.
|
Intersection |
raycast(com.badlogic.gdx.math.Vector3 direction,
float radius,
boolean onlyVisible,
boolean onlySolid)
Trace a ray through the map until ray hits non air block.
|
getHeight, getReferenceX, getReferenceY, getZ, setHeight
public Point(float posX, float posY, float height, boolean relative)
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)relative
- true if relative to currently loaded map, false if absolute (relative to map with chunk 0,0 in its center)public Point(Point point)
point
- the source of the copypublic Point getPoint()
getPoint
in class AbstractPosition
public Coordinate getCoord()
getCoord
in class AbstractPosition
public float[] getRel()
public float getRelX()
public float getRelY()
public float[] getAbs()
public float getAbsX()
public float getAbsY()
public Block getBlock()
getBlock
in class AbstractPosition
AbstractPosition.getBlockSafe()
public Block getBlockSafe()
AbstractPosition
getBlockSafe
in class AbstractPosition
AbstractPosition.getBlock()
public Block getBlockClamp()
public Point cpy()
cpy
in class AbstractPosition
public int getProjectedPosX()
AbstractPosition
getProjectedPosX
in class AbstractPosition
public int getProjectedPosY()
AbstractPosition
getProjectedPosY
in class AbstractPosition
public int getDepth()
AbstractPosition
getDepth
in class AbstractPosition
public boolean onLoadedMap()
AbstractPosition
onLoadedMap
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.Vector3 vector)
addVector
in class AbstractPosition
vector
- all values in game world valuespublic Point addVector(float x, float y, float z)
addVector
in class AbstractPosition
x
- x value to addy
- y value to addz
- height to addpublic Intersection raycast(com.badlogic.gdx.math.Vector3 direction, float radius, boolean onlyVisible, boolean onlySolid)
direction
- direction of the rayradius
- the distane after which it should stop.onlyVisible
- only intersect if true with block which are redered (not clipped)onlySolid
- only intersect if true with block which are not transparent =solidpublic float distanceTo(Point point)
point
-