|
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.Joint
public class Joint
The Joint class represents a joint connecting two bodies.
The joint is a pin joint at a single position
that fixes this point relative to both bodies.
This is the pivot point of the connection.
Two types of joints exists: loose joints or fixed joints.
For loose joints, the relative angle of the bodies can change.
For fixed joints this is fixed as well.
Field Summary | |
---|---|
protected UserData |
mUserData
User data |
Fields inherited from interface at.emini.physics2D.Constraint |
---|
JOINT, MOTOR, SCRIPT, SPRING |
Constructor Summary | |
---|---|
|
Joint(Body b1,
Body b2,
FXVector p1,
FXVector p2,
boolean fixed)
Constructor. |
protected |
Joint(Joint other,
Body[] bodyMapping)
Copy Constructor. |
Method Summary | |
---|---|
boolean |
applyMomentum(float invTimestepFX)
Applies the momentum. |
boolean |
concernsBody(Body b)
Checks if the joint applies to a body. |
Constraint |
copy(Body[] bodyMapping)
Copy method. |
boolean |
equals(Constraint other)
Checks for equality of two constraints. |
Body |
getBody1()
Gets the Body 1 |
Body |
getBody2()
Gets the Body 2 |
float |
getImpulseFX()
Gets the last impulse of teh joint. |
FXVector |
getPoint1()
Gets the absolute joint position (from body1). |
FXVector |
getPoint2()
Gets the absolute joint position (from body2). |
FXVector |
getRawPoint1()
Gets the relative joint position (from body1). |
FXVector |
getRawPoint2()
Gets the relative joint position (from body2). |
UserData |
getUserData()
Get user data. |
boolean |
isFixed()
Gets the flag if it is a fixed joint. |
static Joint |
loadJoint(PhysicsFileReader reader,
java.util.Vector bodies,
UserData userData)
Loads a joint from stream. |
void |
postStep()
Empty. |
void |
precalculate(float invTimestepFX)
Precalculates the mass matrix. |
void |
setBody1(Body b)
Sets the first Body. |
protected void |
setBody2(Body b)
Sets the second Body. |
void |
setCollisionLayer(int layer)
Sets collision layers for joined bodies. |
void |
setFixPoint(FXVector absolutePoint)
Sets the fix point for the joint. |
void |
setUserData(UserData userData)
Set User data |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected UserData mUserData
Constructor Detail |
---|
public Joint(Body b1, Body b2, FXVector p1, FXVector p2, boolean fixed)
b1
- First Bodyb2
- Second Bodyp1
- Relative Position of the pivot to Body 1p2
- relative Position of the pivot to Body 2protected Joint(Joint other, Body[] bodyMapping)
other
- the source objectbodyMapping
- the mapping of bodies in the new world (null if not used).
This is required, so that the joint can find the corresponding bodies in the new environmentMethod Detail |
---|
public Constraint copy(Body[] bodyMapping)
copy
in interface Constraint
bodyMapping
- the mapping of bodies in the new world (null if not used).
This is required, so that the joint can find the corresponding bodies in the new environment
public static Joint loadJoint(PhysicsFileReader reader, java.util.Vector bodies, UserData userData)
reader
- the file readerbodies
- a list of bodies, initially read from the file to match the stored indices
public void setCollisionLayer(int layer)
layer
- the layer number (somewhere between 0 and 32).Body.mColissionBitFlag
public FXVector getPoint1()
public FXVector getPoint2()
public FXVector getRawPoint1()
public FXVector getRawPoint2()
public void setBody1(Body b)
b
- the bodyprotected void setBody2(Body b)
b
- the bodypublic Body getBody1()
public Body getBody2()
public boolean isFixed()
public void precalculate(float invTimestepFX)
precalculate
in interface Constraint
invTimestepFX
- the inverse timestep of the simulationpublic boolean applyMomentum(float invTimestepFX)
applyMomentum
in interface Constraint
invTimestepFX
- the inverse timestep of the simulationpublic void postStep()
postStep
in interface Constraint
public float getImpulseFX()
getImpulseFX
in interface Constraint
public boolean concernsBody(Body b)
concernsBody
in interface Constraint
b
- the body to be checked
public boolean equals(Constraint other)
equals
in interface Constraint
other
- the comparison constraint
public void setFixPoint(FXVector absolutePoint)
absolutePoint
- the fix point in absolute coordinatespublic UserData getUserData()
getUserData
in interface Constraint
public void setUserData(UserData userData)
userData
- the user data
|
Emini Physics Engine 1.3.5a API Documentation | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |