|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--noope.entities.Entity
This class represents a physical object modelled. Physics, the physics engine class, contains an object of the Entities class, which stores internally, a list of Entities. It also stores an internal forceAccumulator that is used by the Law objects to accumulate their contibution to the total force on that Entity.
Field Summary | |
protected java.lang.String |
name
The name associated with this Entity |
protected Physics |
physics
A reference to the physics world so getActiveForce can learn about its environment. |
protected LawPropertyRecord[] |
properties
An array of LawPropertyRecords that store the properties of this entity for each Law currently in use |
Constructor Summary | |
Entity(BlockReader br,
Physics phys)
Construcst an Entity from the supplied BlockReader. |
Method Summary | |
void |
addForce(Vector3D force)
Apply a force to this Entity. |
void |
dispose()
Disposes of system resources. |
protected Vector3D |
getActiveForce()
Return this Entity's own contribution to the resultant force. |
double |
getInertialMass()
Return this Entity's inertial mass, used in Newton's second law (F = ma) calculations |
java.lang.String |
getName()
Return this Entity's name |
Physics |
getPhysics()
Returns the Physics object this Entity belongs to. |
Vector3D |
getPosition()
Return this Entity's position |
LawPropertyRecord |
getPropertyRecord(int lawnumber)
This method gets the LawPropertyRecord corresponding to the law with the given number. |
Vector3D |
getVelocity()
Return this Entity's velocity |
void |
setPosition(Vector3D newPosition)
While I was at it, I've also added this method, in case it'll be needed later for some other law. |
void |
setVelocity(Vector3D newVelocity)
This method has been added, because it is needed by certain laws like SphereCollision. |
void |
step(double deltaTime)
Apply Newtonian physics to update velocity and position. |
java.lang.String |
toString()
Returns a String representation of the Entity for debug-quality printing. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected java.lang.String name
protected LawPropertyRecord[] properties
protected Physics physics
Constructor Detail |
public Entity(BlockReader br, Physics phys) throws BRLoadingException
br
- BlockReader used to initialise name, position, velocity, inertialMass and properties.phys
- Reference to the Physics worldMethod Detail |
public double getInertialMass()
public Vector3D getPosition()
public Vector3D getVelocity()
public java.lang.String getName()
public LawPropertyRecord getPropertyRecord(int lawnumber)
Laws.Laws(BlockReader, Physics)
,
Law.constructNewPropertyRecord(BlockReader, Entity)
public void addForce(Vector3D force)
public void step(double deltaTime)
deltaTime
- the time step to use when updating velocity and positionprotected Vector3D getActiveForce()
public java.lang.String toString()
toString
in class java.lang.Object
public void setVelocity(Vector3D newVelocity)
public void setPosition(Vector3D newPosition)
public Physics getPhysics()
public void dispose()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |