Package | Description |
---|---|
city.cs.engine |
Simple wrapper around the JBox2D physics engine.
|
org.jbox2d.common |
Modifier and Type | Method and Description |
---|---|
Vec2 |
WorldView.getCentre()
The point in the world that is the current centre of the view.
|
Vec2 |
Body.getLinearVelocity()
The linear (straight line) velocity of the centre of mass of this body.
|
Vec2 |
CollisionEvent.getNormal()
A vector of length 1 perpendicular to the line of contact,
pointing toward the other body.
|
Vec2 |
AttachedImage.getOffset()
The offset for this image instance.
|
Vec2 |
Body.getPosition()
The current position in the world of this body's origin point.
|
Vec2 |
CollisionEvent.getPosition()
The position of the collision.
|
Vec2 |
CollisionEvent.getVelocity()
Velocity of the other body relative to this one.
|
Vec2 |
WorldView.viewToWorld(Point2D p)
Convert from screen to world coordinates through the current view.
|
Modifier and Type | Method and Description |
---|---|
void |
DynamicBody.applyForce(Vec2 force)
Apply a force to this body at its centre of mass.
|
void |
DynamicBody.applyForce(Vec2 force,
Vec2 point)
Apply a force to this body at a specified position in the world.
|
void |
DynamicBody.applyImpulse(Vec2 impulse)
Apply an impulse to this body at its centre of mass.
|
void |
DynamicBody.applyImpulse(Vec2 impulse,
Vec2 point)
Apply an impulse to this body at a specified position in the world.
|
boolean |
Body.contains(Vec2 p)
Is the point inside any of the fixtures of this body?
|
boolean |
Fixture.contains(Vec2 p)
Is the point inside this fixture?
|
boolean |
Body.intersects(Vec2 centre,
float halfWidth,
float halfHeight)
Do any of the fixtures attached to this body currently overlap a given
axis-aligned rectangle.
|
boolean |
Fixture.intersects(Vec2 centre,
float halfWidth,
float halfHeight)
Does this fixture currently overlap a given axis-aligned rectangle.
|
void |
Body.move(Vec2 dp)
Move this body relative to its current position in the world.
|
void |
Body.rotate(Vec2 p,
float dTheta)
Rotate this body from its current orientation around a specified point.
|
void |
Body.rotateDegrees(Vec2 p,
float dTheta)
Rotate this body from its current orientation around a specified point.
|
void |
WorldView.setCentre(Vec2 centre)
Reposition the view.
|
void |
DynamicBody.setLinearVelocity(Vec2 velocity)
Set this body's linear velocity.
|
void |
AttachedImage.setOffset(Vec2 offset)
Set the offset for this image instance.
|
void |
Body.setPosition(Vec2 position)
Set the position in the world of this body's origin point.
|
void |
WorldView.setView(Vec2 centre,
float zoom)
Reposition and zoom the view.
|
Point2D.Float |
WorldView.worldToView(Vec2 v)
Convert from world coordinates to screen coordinates in the
current view.
|
Constructor and Description |
---|
AttachedImage(Body body,
BodyImage image,
float scale,
float rotation,
Vec2 offset)
Create a new instance of an image.
|
BoxShape(float halfWidth,
float halfHeight,
Vec2 centre)
Initialise an axis-aligned rectangle with a specified centre.
|
BoxShape(float halfWidth,
float halfHeight,
Vec2 centre,
float angle)
Initialise a rotated rectangle with a specified centre.
|
CircleShape(float radius,
Vec2 centre)
Initialise a new circle centred at the given offset from the shape's origin.
|
Constructor and Description |
---|
PolygonShape(List<Vec2> vertices)
Initialise a convex polygon given a list of its vertices,
relative to the shape's origin.
|
Modifier and Type | Method and Description |
---|---|
Vec2 |
Vec2.add(Vec2 v)
Return the sum of this vector and another; does not alter either one.
|
Vec2 |
Vec2.mul(float a)
Return this vector multiplied by a number; does not alter this vector.
|
Vec2 |
Vec2.negate()
Return the negation of this vector; does not alter this vector.
|
Vec2 |
Vec2.sub(Vec2 v)
Return the difference between this vector and another; does not
alter either one.
|
Modifier and Type | Method and Description |
---|---|
Vec2 |
Vec2.add(Vec2 v)
Return the sum of this vector and another; does not alter either one.
|
static float |
Vec2.cross(Vec2 a,
Vec2 b)
The z-component of the cross product of two vectors.
|
static float |
Vec2.dot(Vec2 a,
Vec2 b)
The dot product of two vectors.
|
Vec2 |
Vec2.sub(Vec2 v)
Return the difference between this vector and another; does not
alter either one.
|