|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xith3d.physics.simulation.SimulationEngine
public abstract class SimulationEngine
A simulation engine
| Field Summary | |
|---|---|
protected java.util.ArrayList<SimulationWorld> |
worlds
|
| Constructor Summary | |
|---|---|
protected |
SimulationEngine()
|
| Method Summary | |
|---|---|
void |
destroyWorld(SimulationWorld world)
Destroys the given SimulationWorld. |
long |
getMaxStepSize()
|
long |
getStepSize()
|
java.util.ArrayList<SimulationWorld> |
getWorlds()
|
boolean |
isEnabled()
|
SurfaceParameters |
newSurfaceParameters()
|
abstract SurfaceParameters |
newSurfaceParameters(java.lang.String[] paramStrings,
java.lang.Object[] paramValues)
Creates a new SurfaceParameters with specified params. |
SimulationWorld |
newWorld()
Creates a new Simulation World. |
abstract SimulationWorld |
newWorldImpl()
Creates a new Simulation World. |
void |
setCollisionResolversManager(CollisionResolversManager collisionResolversManager)
|
void |
setEnabled(boolean enabled)
Sets this SimulationEngine enabled/disabled. |
void |
setMaxStepSize(long micros)
Sets the maximum internal step time in microseconds. |
void |
setStepSize(long micros)
Sets the constant internal step time in microseconds. |
void |
step(long stepMicros)
Step the simulation = advance the time |
void |
update(long gameTime,
long frameTime,
UpdatingThread.TimingMode timingMode)
Updates this Updatable object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final java.util.ArrayList<SimulationWorld> worlds
| Constructor Detail |
|---|
protected SimulationEngine()
| Method Detail |
|---|
public final java.util.ArrayList<SimulationWorld> getWorlds()
public abstract SimulationWorld newWorldImpl()
public final SimulationWorld newWorld()
public abstract SurfaceParameters newSurfaceParameters(java.lang.String[] paramStrings,
java.lang.Object[] paramValues)
paramStrings - the param strings to be specified, e.g. "mu" or "bounce"paramValues - the values of the params to be specified, e.g. ".1f" or "true"public final SurfaceParameters newSurfaceParameters()
SurfaceParameters filled with default values.public void destroyWorld(SimulationWorld world)
world - public final void setStepSize(long micros)
micros - public final long getStepSize()
public final void setMaxStepSize(long micros)
micros - public final long getMaxStepSize()
public final void step(long stepMicros)
stepMicros - the size of the step which should
be taken. Note that 2 steps of .01f isn't equal to
1 step of .02f : the smaller is your stepSize, the
more accurate your simulation (but computations take
more time). As always, you should find a tradeoff
between speed and accuracy (which is the whole point
of physic simulation, anyway).
Begin with .01f and adjust it later if you don't know
what to put.
Note : you could also make the stepSize "adaptative",
ie proportional to the (real) time that has passed since
the last step, but sometimes adaptive stepSize can
cause some simulation problems (jumps, instability).
If you have these problems you could also try to
advance by the right quantity of time by several
fixed size steps.public final void setCollisionResolversManager(CollisionResolversManager collisionResolversManager)
public final void setEnabled(boolean enabled)
setEnabled in interface org.jagatoo.datatypes.Enableableenabled - public final boolean isEnabled()
isEnabled in interface org.jagatoo.datatypes.Enableable
public final void update(long gameTime,
long frameTime,
UpdatingThread.TimingMode timingMode)
update in interface UpdatablegameTime - the gameTime in MillisecondsframeTime - the frameTime in Milliseconds (needed time for the last frame)timingMode - the TimingMode to use for frameTime.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||