|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvooga.physicsEngine.geometry.GeometricParameters
vooga.physicsEngine.PhysicalParameters
public class PhysicalParameters
Class that encapsulates the parameters of a physical body. This extends
GeometricParameters
because it not only includes the shape,
position, angular position (geometric parameters), but also velocities, mass,
moment of inertia, and other physical quantities.
Field Summary |
---|
Fields inherited from class vooga.physicsEngine.geometry.GeometricParameters |
---|
shape |
Constructor Summary | |
---|---|
PhysicalParameters(Shape shape)
Called by outside users of physics module to create an encapsulation of a physical object with given Shape |
Method Summary | |
---|---|
void |
applyAngularImpulse(double angularImpulse)
Apply an instantaneous angular impulse on the object |
void |
applyImpulse(Vector2f impulse)
Apply an instantaneous impulse on the object |
void |
endFrame()
Called every time updatePosition is called for the body |
double |
getAngularVelocity()
|
java.util.Set<PhysicalParameters> |
getCollideSet()
Return the set of PhysicalParameters that the object is
currently in collision with. |
Vector2f |
getConstantAcceleration()
|
double |
getConstantTorque()
|
double |
getDamping()
|
double |
getElasticity()
|
double |
getFrictionCoefficient()
|
protected double |
getInvI()
|
protected double |
getInvMass()
|
double |
getMass()
|
double |
getMomentOfInertia()
If the moment of inertia is not explicitly set, then this will return an estimate based on the mass and the shape of the object. |
double |
getRotationalDamping()
|
Vector2f |
getVelocity()
|
boolean |
inCollisionWith(PhysicalParameters param)
Check if the last time the physics engine updated the object, the object collided. |
void |
incrementAngularVelocity(double delta)
Adds to the current angular velocity. |
void |
incrementVelocity(Vector2f difference)
Adds to the current velocity. |
boolean |
isMovable()
|
protected void |
notifyCollided(PhysicalParameters param)
Called when this PhysicalParameters collides with another. |
void |
setAngularVelocity(double angularVelocity)
|
void |
setConstantAcceleration(Vector2f constantAcceleration)
Apply a constant acceleration on the object. |
void |
setConstantForce(Vector2f constantForce)
|
void |
setConstantTorque(double constantTorque)
Apply a constant torque to the object. |
void |
setDamping(double damping)
Set the air translational damping of the object. |
void |
setElasticity(double elasticity)
|
void |
setFrictionCoefficient(double frictionCoefficient)
|
void |
setMass(double mass)
|
void |
setMomentOfInertia(double i)
|
void |
setMovable(boolean movable)
Makes an object movable or immovable. |
void |
setRotationalDamping(double rotationalDamping)
Sets the rotational damping of the object. |
void |
setVelocity(Vector2f velocity)
|
void |
startFrame()
Called at the beginning when processPhysics is called for the body |
Methods inherited from class vooga.physicsEngine.geometry.GeometricParameters |
---|
drawShape, getAbsoluteCoordinate, getAngularPosition, getCentroidPosition, getJavaShape, getShape, getTransformedArea, incrementAngularPosition, incrementPosition, setAngularPosition, setCentroidPosition |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PhysicalParameters(Shape shape)
Shape
shape
- Method Detail |
---|
protected void notifyCollided(PhysicalParameters param)
PhysicalParameters
collides with another.
param
- the other Physicalparameters
object that collidedpublic boolean inCollisionWith(PhysicalParameters param)
param
-
public void setVelocity(Vector2f velocity)
velocity
- the velocity to setpublic Vector2f getVelocity()
public void setAngularVelocity(double angularVelocity)
angularVelocity
- the angularVelocity to setpublic double getAngularVelocity()
public void setMomentOfInertia(double i)
i
- the moment of inertiapublic double getMomentOfInertia()
public void setElasticity(double elasticity)
elasticity
- the elasticity to setpublic double getElasticity()
public void setFrictionCoefficient(double frictionCoefficient)
frictionCoefficient
- the frictionCoefficient to setpublic double getFrictionCoefficient()
public void setConstantForce(Vector2f constantForce)
constantForce
- the force to setpublic Vector2f getConstantAcceleration()
public void setConstantAcceleration(Vector2f constantAcceleration)
constantAcceleration
- public void setMass(double mass)
mass
- the mass to setpublic double getMass()
protected double getInvMass()
protected double getInvI()
public void startFrame()
public void endFrame()
public void setMovable(boolean movable)
movable
- the movable to setpublic boolean isMovable()
Physicalparameters
is movablepublic void setConstantTorque(double constantTorque)
constantTorque
- the constantTorque to setpublic double getConstantTorque()
public void incrementVelocity(Vector2f difference)
difference
- the delta changepublic void incrementAngularVelocity(double delta)
delta
- public void applyImpulse(Vector2f impulse)
public void applyAngularImpulse(double angularImpulse)
public void setDamping(double damping)
damping
- the damping to setpublic double getDamping()
public double getRotationalDamping()
public void setRotationalDamping(double rotationalDamping)
rotationalDamping
- the rotationalDamping to setpublic java.util.Set<PhysicalParameters> getCollideSet()
PhysicalParameters
that the object is
currently in collision with.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |