|
Emini Physics Engine 1.3.5a API Documentation | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectat.emini.physics2D.Script
public class Script
The script class represents a sequence of actions for a body.
It represents a sequence of "hard constraints"
that can be repeated indefinitely.
Each script consists of simple script elements.
Each element can influence the position, velocity or acceleration
of the body.
Nested Class Summary | |
---|---|
class |
Script.ScriptElement
Single action element for a script. |
Field Summary | |
---|---|
static int |
ACCELERATION
Element Type acceleration |
static int |
ANGLE
Element Type angle |
protected java.util.Vector |
mElements
Vector containing the scripting elements . |
protected boolean |
mRestart
Flag if the script is restarted after finishing. |
static int |
NONE
Element Type none |
static int |
POSITION
Element Type position |
static int |
ROTATIONAL_ACCELERATION
Element Type acceleration |
static int |
ROTATIONAL_VELOCITY
Element Type velocity |
static int |
VELOCITY
Element Type velocity |
Constructor Summary | |
---|---|
Script(boolean restart)
Constructor. |
|
Script(Script script)
Copy constructor. |
Method Summary | |
---|---|
void |
addElement(int type,
int target1,
int timeSteps)
Adds a new element to the script (only rotational elements). |
void |
addElement(int type,
int target1,
int target2,
int timeSteps)
Adds a new element to the script. |
void |
addElement(Script.ScriptElement element)
Adds a script element directly. |
void |
applyToBody(Body b,
World w)
Applies the script to a body. |
Script |
copy()
Copy method for the script object |
protected void |
executeScript(int index,
World w)
Executes the script. |
static Script |
loadScript(PhysicsFileReader reader)
Loads a script from a stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int NONE
public static final int POSITION
public static final int VELOCITY
public static final int ACCELERATION
public static final int ANGLE
public static final int ROTATIONAL_VELOCITY
public static final int ROTATIONAL_ACCELERATION
protected java.util.Vector mElements
protected boolean mRestart
Constructor Detail |
---|
public Script(boolean restart)
restart
- the flag, if the script is restarted after finishing.public Script(Script script)
script
- the source script objectMethod Detail |
---|
public Script copy()
public void applyToBody(Body b, World w)
b
- the bodyw
- the world managing the scriptspublic void addElement(int type, int target1, int target2, int timeSteps)
type
- the type of the element (position, velocity, etc.).target1
- the first target value.target2
- the second target value (only relevant for the vector types).timeSteps
- the number of timesteps.public void addElement(int type, int target1, int timeSteps)
type
- the type of the element (position, velocity, etc.).target1
- the first target value.timeSteps
- the number of timesteps.public void addElement(Script.ScriptElement element)
element
- the script element.protected void executeScript(int index, World w)
index
- the execution index (referring to the corresponding body, stored in the world)w
- the worldpublic static Script loadScript(PhysicsFileReader reader)
reader
- the file reader.
|
Emini Physics Engine 1.3.5a API Documentation | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |