public class BodyModel extends java.lang.Object implements Body
Constructor and Description |
---|
BodyModel()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
getHeight()
Get the height.
|
int |
getLocationIntX()
Get the current rounded horizontal location.
|
int |
getLocationIntY()
Get the current rounded vertical location.
|
int |
getLocationOffsetX()
Get the horizontal offset location.
|
int |
getLocationOffsetY()
Get the vertical offset location.
|
double |
getLocationOldX()
Get the old horizontal location.
|
double |
getLocationOldY()
Get the old vertical location.
|
double |
getLocationX()
Get the current horizontal location.
|
double |
getLocationY()
Get the current vertical location.
|
double |
getMass()
Get body mass.
|
double |
getWeight()
Get body weight.
|
int |
getWidth()
Get the width.
|
void |
invertAxisY(boolean state)
True to invert Y axis.
|
void |
moveLocation(double extrp,
double vx,
double vy)
Move location using a simple force.
|
void |
moveLocation(double extrp,
Force force,
Force... forces)
Move location using different forces.
|
void |
resetGravity()
Reset gravity force (usually when hit the ground).
|
void |
setGravityMax(double max)
Set the maximum gravity value.
|
void |
setLocation(double x,
double y)
Set location instantly.
|
void |
setLocationOffset(double x,
double y)
Set location offset.
|
void |
setLocationX(double x)
Set horizontal location.
|
void |
setLocationY(double y)
Set vertical location.
|
void |
setMass(double mass)
Set body mass.
|
void |
setSize(int width,
int height)
Set size.
|
void |
teleport(double x,
double y)
Teleport to a new location.
|
void |
teleportX(double x)
Teleport to a new horizontal location.
|
void |
teleportY(double y)
Teleport to a new vertical location.
|
void |
updateGravity(double extrp,
int desiredFps,
Force... forces)
Update gravity calculation.
|
public void updateGravity(double extrp, int desiredFps, Force... forces)
Body
updateGravity
in interface Body
extrp
- The extrapolation value.desiredFps
- The desired fps (usually 60)forces
- The list of forces.public void resetGravity()
Body
resetGravity
in interface Body
public void invertAxisY(boolean state)
Body
invertAxisY
in interface Body
state
- The state.public void setGravityMax(double max)
Body
setGravityMax
in interface Body
max
- The maximum gravity value.public void setMass(double mass)
Body
public double getMass()
Body
public double getWeight()
Body
public void teleport(double x, double y)
Localizable
teleport
in interface Localizable
x
- The new horizontal location.y
- The new vertical location.public void teleportX(double x)
Localizable
teleportX
in interface Localizable
x
- The new horizontal location.public void teleportY(double y)
Localizable
teleportY
in interface Localizable
y
- The new vertical location.public void moveLocation(double extrp, Force force, Force... forces)
Localizable
moveLocation
in interface Localizable
extrp
- The extrapolation value.force
- The primary force.forces
- The other forces.public void moveLocation(double extrp, double vx, double vy)
Localizable
moveLocation
in interface Localizable
extrp
- The extrapolation value.vx
- The horizontal force.vy
- The vertical force.public void setLocation(double x, double y)
Localizable
setLocation
in interface Localizable
x
- The new horizontal location.y
- The new vertical location.public void setLocationX(double x)
Localizable
setLocationX
in interface Localizable
x
- The new horizontal location.public void setLocationY(double y)
Localizable
setLocationY
in interface Localizable
y
- The new vertical location.public void setLocationOffset(double x, double y)
Localizable
setLocationOffset
in interface Localizable
x
- The new horizontal location offset.y
- The new vertical location offset.public void setSize(int width, int height)
Localizable
setSize
in interface Localizable
width
- The width.height
- The height.public double getLocationX()
Localizable
getLocationX
in interface Localizable
public double getLocationY()
Localizable
getLocationY
in interface Localizable
public int getLocationIntX()
Surface
getLocationIntX
in interface Surface
public int getLocationIntY()
Surface
getLocationIntY
in interface Surface
public double getLocationOldX()
Localizable
getLocationOldX
in interface Localizable
public double getLocationOldY()
Localizable
getLocationOldY
in interface Localizable
public int getLocationOffsetX()
Surface
getLocationOffsetX
in interface Surface
public int getLocationOffsetY()
Surface
getLocationOffsetY
in interface Surface
public int getWidth()
Surface