public class PhysicsComponent
extends com.almasb.ents.AbstractComponent
| Constructor and Description |
|---|
PhysicsComponent() |
| Modifier and Type | Method and Description |
|---|---|
void |
applyAngularImpulse(float impulse)
Apply an angular impulse.
|
void |
applyBodyAngularImpulse(float impulse)
Apply an angular impulse.
|
void |
applyBodyForce(com.almasb.gameutils.math.Vec2 force,
com.almasb.gameutils.math.Vec2 point)
Apply a force at a world point.
|
void |
applyBodyForceToCenter(com.almasb.gameutils.math.Vec2 force)
Apply a force to the center of mass.
|
void |
applyBodyLinearImpulse(com.almasb.gameutils.math.Vec2 impulse,
com.almasb.gameutils.math.Vec2 point,
boolean wake)
Apply an impulse at a point.
|
void |
applyBodyTorque(float torque)
Apply a torque.
|
void |
applyForce(javafx.geometry.Point2D force,
javafx.geometry.Point2D point)
Apply a force at a world point.
|
void |
applyForceToCenter(javafx.geometry.Point2D force)
Apply a force to the center of mass.
|
void |
applyLinearImpulse(javafx.geometry.Point2D impulse,
javafx.geometry.Point2D point,
boolean wake)
Apply an impulse at a point.
|
void |
applyTorque(float torque)
Apply a torque.
|
javafx.geometry.Point2D |
getLinearVelocity() |
double |
getVelocityX() |
double |
getVelocityY() |
boolean |
isRaycastIgnored() |
void |
setAngularVelocity(double velocity)
Set velocity (angle in deg) at which the entity will rotate per tick.
|
void |
setBodyDef(org.jbox2d.dynamics.BodyDef def)
Set custom body definition to describe a generated
body for this physics entity.
|
void |
setBodyLinearVelocity(com.almasb.gameutils.math.Vec2 vector)
Set linear velocity for a physics entity.
|
void |
setBodyType(org.jbox2d.dynamics.BodyType type)
A convenience method to avoid setting body definition
if only a change of body type is required.
|
void |
setFixtureDef(org.jbox2d.dynamics.FixtureDef def)
Set custom fixture definition to describe a generated
fixture for this physics entity.
|
void |
setLinearVelocity(double x,
double y)
Set linear velocity for a physics entity.
|
void |
setLinearVelocity(javafx.geometry.Point2D vector)
Set linear velocity for a physics entity.
|
void |
setOnPhysicsInitialized(Runnable code)
Set a callback to run when this entity has been added to physics world.
|
void |
setRaycastIgnored(boolean b)
Set true to make raycast ignore this entity.
|
void |
setVelocityX(double x) |
void |
setVelocityY(double y) |
public void setOnPhysicsInitialized(Runnable code)
code - the code to runpublic void setFixtureDef(org.jbox2d.dynamics.FixtureDef def)
def - fixture definitionpublic void setBodyDef(org.jbox2d.dynamics.BodyDef def)
def - body definitionpublic void setBodyType(org.jbox2d.dynamics.BodyType type)
type - body typepublic void setLinearVelocity(javafx.geometry.Point2D vector)
Use this method to move a physics entity. Please note that the vector x and y are in pixels.
vector - x and y in pixelspublic void setLinearVelocity(double x,
double y)
Use this method to move a physics entity. Please note that x and y are in pixels.
x - and y in pixelspublic void setVelocityX(double x)
public void setVelocityY(double y)
public double getVelocityX()
public double getVelocityY()
public void setBodyLinearVelocity(com.almasb.gameutils.math.Vec2 vector)
Similar to setLinearVelocity(Point2D) but
x and y of the argument are in meters.
vector - x and y in meterspublic javafx.geometry.Point2D getLinearVelocity()
public void setAngularVelocity(double velocity)
velocity - value in ~ degrees per tickpublic void applyLinearImpulse(javafx.geometry.Point2D impulse,
javafx.geometry.Point2D point,
boolean wake)
impulse - the world impulse vector (in pixel/sec)point - the world position of the point of application (in pixel)wake - if this impulse should wake up the bodypublic void applyBodyLinearImpulse(com.almasb.gameutils.math.Vec2 impulse,
com.almasb.gameutils.math.Vec2 point,
boolean wake)
impulse - the world impulse vector (in meter/sec)point - the world position of the point of application (in meter)wake - if this impulse should wake up the bodypublic void applyForce(javafx.geometry.Point2D force,
javafx.geometry.Point2D point)
force - the world force vector (in pixel/sec)point - the world position of the point of application (in pixel)public void applyBodyForce(com.almasb.gameutils.math.Vec2 force,
com.almasb.gameutils.math.Vec2 point)
force - the world force vector (in meter/sec)point - the world position of the point of application (in meter)public void applyForceToCenter(javafx.geometry.Point2D force)
force - the world force vector (in pixel/sec)public void applyBodyForceToCenter(com.almasb.gameutils.math.Vec2 force)
force - the world force vector (in meter/sec)public void applyAngularImpulse(float impulse)
impulse - the angular impulse (in pixel/sec)public void applyBodyAngularImpulse(float impulse)
impulse - the angular impulse (in meter/sec)public void applyTorque(float torque)
torque - the force (in pixel)public void applyBodyTorque(float torque)
torque - the force (in meter)public void setRaycastIgnored(boolean b)
b - raycast flagpublic boolean isRaycastIgnored()
Copyright © 2016. All rights reserved.