|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvooga.gameEngine.game.GameRelatedObject
vooga.gameEngine.item.GameItem
vooga.physicsEngine.PhysicalItem
public class PhysicalItem
A game item that involves physics. This is the game designer's main API to physics related functionalities.
Field Summary | |
---|---|
GamePhysicalParameters |
parameters
This is the internal parameters encapsulation of this physicalItem. |
Constructor Summary | |
---|---|
PhysicalItem(Shape shape)
Create a PhysicalItem based on a vooga.physicsEngine.geometry.shapes.Shape object. |
|
PhysicalItem(Shape shape,
java.awt.Color color)
Create a Physical item with given vooga.physicsEngine.geometry.shapes.Shape and color. |
|
PhysicalItem(Texture texture,
double centroidX,
double centroidY)
Creates a physical item based on a Texture object, which
basically represents an object image. |
Method Summary | |
---|---|
void |
applyAngularImpulse(double angularImpulse)
Apply an angular impulse on the object |
void |
applyImpulse(Vector2f impulse)
Apply an impulse on the object |
boolean |
getPhysicsOn()
Checks if physics is turned on for this item. |
void |
setConstantForce(Vector2f constantForce)
Sets a sustained force on the object (i.e. |
void |
setPhysicsOn(boolean physicsOn)
Sets whether physics should be turned on for this item. |
void |
setPosition(double x,
double y)
Set the game position of an object. |
void |
setPosition(Vector2f position)
Set the game position of an object. |
Methods inherited from class vooga.gameEngine.item.GameItem |
---|
compareTo, getPosition, getRotation, getShape, getSize, getTexture, isVisible, move, resize, rotate, setPosition, setRotation, setSize, setVisibility |
Methods inherited from class vooga.gameEngine.game.GameRelatedObject |
---|
addEventListener, clearListeners, equals, fire, fire, fire, getEventListeners, getID, getListenerCount, removeEventListener |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public final GamePhysicalParameters parameters
Constructor Detail |
---|
public PhysicalItem(Shape shape)
vooga.physicsEngine.geometry.shapes.Shape
object. The
default color is black.
parameters
- internal encapsulation of physical propertiespublic PhysicalItem(Shape shape, java.awt.Color color)
vooga.physicsEngine.geometry.shapes.Shape
and color.
shape
- color
- public PhysicalItem(Texture texture, double centroidX, double centroidY)
Creates a physical item based on a Texture
object, which
basically represents an object image. This will internally create a
PhysicalParameters
object based on the shape of the texture
object.
The centroidX and centroidY are where the centroid of the texture object is IN THE TEXTURE's COORDINATES. This is important because we need this information to represent the texture object internally, and the wrong centroid can result in un-physical situations in which the centroid is outside, which will break the physics engine because that assumes the centroid is always inside the object and the object is convex.
texture
- centroidX
- centroidY
- Method Detail |
---|
public void setPosition(Vector2f position)
setPosition(Position)
function.
position
- public void setPosition(double x, double y)
setPosition(Position)
function.
x
- y
- public void setPhysicsOn(boolean physicsOn)
physicsOn
- public boolean getPhysicsOn()
public void applyImpulse(Vector2f impulse)
impulse
- public void applyAngularImpulse(double angularImpulse)
angularImpulse
- public void setConstantForce(Vector2f constantForce)
constantForce
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |