|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.jmex.physics.PhysicsSpace
public abstract class PhysicsSpace
PhysicsSpace is the central class of the jME Physics API. PhysicsNodes from the same space can interact
with each other. Multiple spaces can be used to model independent physics simulation parts.
PhysicsSpace is used to create PhysicNodes via the createDynamicNode() and createStaticNode() methods.
update(float) to let the simulation advance. While update is not called
the simulation is paused.
| Nested Class Summary | |
|---|---|
protected static interface |
PhysicsSpace.Factory
Interface for subclasses to register a factory for them. |
| Field Summary | |
|---|---|
static java.lang.String |
LOGGER_NAME
|
| Constructor Summary | |
|---|---|
protected |
PhysicsSpace()
Default constructor. |
| Method Summary | |
|---|---|
protected int |
addCollisionGroup(CollisionGroup value)
add group |
protected void |
addJoint(Joint joint)
Adds a Joint to this space. |
protected void |
addNode(PhysicsNode node)
Adds a PhysicsNode to this space. |
boolean |
addToUpdateCallbacks(PhysicsUpdateCallback value)
|
protected void |
adjustContact(PendingContact contact)
Called by update(float) to determine contact details. |
static void |
chooseImplementation(java.lang.String implementationName)
Choose an implementation by name to be used in the next call to create(). |
abstract boolean |
collide(PhysicsSpatial spatial1,
PhysicsSpatial spatial2)
|
protected void |
collisionEvent(ContactInfo info)
Called by subclasses upon each collision event that could be processed by the application. |
static PhysicsSpace |
create()
Create an implementation specific instance of PhysicsSpace. |
protected PhysicsBox |
createBox(java.lang.String name,
PhysicsNode node)
Create a physics box. |
protected PhysicsCapsule |
createCapsule(java.lang.String name,
PhysicsNode node)
Create a physics capsule. |
abstract CollisionGroup |
createCollisionGroup(java.lang.String name)
Create a CollisionGroup. |
protected PhysicsCylinder |
createCylinder(java.lang.String name,
PhysicsNode node)
Create a physics cylinder. |
abstract DynamicPhysicsNode |
createDynamicNode()
|
abstract Joint |
createJoint()
|
protected PhysicsMesh |
createMesh(java.lang.String name,
PhysicsNode node)
Create a physics mesh. |
protected PhysicsRay |
createRay(java.lang.String name,
PhysicsNode node)
Create a physics ray. |
protected PhysicsSphere |
createSphere(java.lang.String name,
PhysicsNode node)
Create a physics sphere. |
abstract StaticPhysicsNode |
createStaticNode()
|
abstract void |
delete()
Delete all physics for this space. |
void |
drawImplementationSpecificPhysics(com.jme.renderer.Renderer renderer)
|
static java.util.Set<java.lang.String> |
getAvailableImplementations()
|
com.jme.input.util.SyntheticButton |
getCollisionEventHandler()
All phyics collisions are reported to this synthetic button to allow the application to react on collisions. |
java.util.List<? extends CollisionGroup> |
getCollisionGroups()
|
java.util.List<ContactCallback> |
getContactCallbacks()
Add/Remove/Query callbacks for specifying contact details. |
abstract CollisionGroup |
getDefaultCollisionGroup()
|
Material |
getDefaultMaterial()
The default material used for nodes without material set. |
abstract com.jme.math.Vector3f |
getDirectionalGravity(com.jme.math.Vector3f store)
Query the gravity in this space. |
protected static PhysicsSpace.Factory |
getFactory()
|
protected PhysicsUpdateCallback |
getFromUpdateCallbacks(int index)
Get an element from the updateCallbacks association. |
abstract java.util.List<? extends Joint> |
getJoints()
|
abstract java.util.List<? extends PhysicsNode> |
getNodes()
|
abstract CollisionGroup |
getStaticCollisionGroup()
Note: this method might return the same group like getDefaultCollisionGroup(). |
abstract void |
pick(PhysicsSpatial spatial)
|
void |
removeAllFromUpdateCallbacks()
|
protected void |
removeCollisionGroup(CollisionGroup value)
|
boolean |
removeFromUpdateCallbacks(PhysicsUpdateCallback value)
|
protected void |
removeJoint(Joint joint)
Removes a Joint from this space. |
protected void |
removeNode(PhysicsNode node)
Removes a PhysicsNode from this space. |
abstract void |
setAccuracy(float value)
Change the accuracy of the underlying physics simulation. |
abstract void |
setAutoRestThreshold(float threshold)
This method sets the "rest" threshold, if the implementation supports ignoring dynamic physics nodes that do not move. |
void |
setDefaultMaterial(Material value)
Change default material for nodes without a material set. |
abstract void |
setDirectionalGravity(com.jme.math.Vector3f gravity)
Specify the overall directional gravity in this space. |
protected static void |
setFactory(PhysicsSpace.Factory value)
|
void |
setupBinaryClassLoader(com.jme.util.export.binary.BinaryImporter importer)
|
protected int |
sizeOfUpdateCallbacks()
|
abstract void |
update(float time)
This method is called by the application to process a simulation timestep. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String LOGGER_NAME
| Constructor Detail |
|---|
protected PhysicsSpace()
| Method Detail |
|---|
public abstract void update(float time)
PhysicsUpdateCallback according to their contract.
time - time the simulation should advanceprotected void adjustContact(PendingContact contact)
update(float) to determine contact details. The default implementation iterates the
contactCallbacks (descending indexes) to determine the details.
contact - contact that needs detailsPendingContact,
getContactCallbacks(),
ContactCallbackpublic final java.util.List<ContactCallback> getContactCallbacks()
adjustContact(com.jmex.physics.contact.PendingContact)protected void addNode(PhysicsNode node)
PhysicsNode to this space. A newly created PhysicsNode is automatically added.
node - the PhysicsNode to addprotected void addJoint(Joint joint)
Joint to this space. A newly created Joint is automatically added.
joint - the Joint to addprotected void removeNode(PhysicsNode node)
PhysicsNode from this space. Use addNode(PhysicsNode) to add it again.
node - the PhysicsNode to removeprotected void removeJoint(Joint joint)
Joint from this space. Use addJoint(Joint) to add it again.
joint - the PhysicsJoint to removepublic Material getDefaultMaterial()
public void setDefaultMaterial(Material value)
value - new default material
java.lang.IllegalArgumentException - if parameter is nullpublic abstract java.util.List<? extends PhysicsNode> getNodes()
public abstract java.util.List<? extends Joint> getJoints()
public abstract void delete()
public abstract void pick(PhysicsSpatial spatial)
public abstract boolean collide(PhysicsSpatial spatial1,
PhysicsSpatial spatial2)
public abstract void setAutoRestThreshold(float threshold)
threshold - if this threashold for linear or rotational velocity is not reaching during several simulation
steps the physics node rests until it collides, is moved or altered in another wayDynamicPhysicsNode.rest(),
DynamicPhysicsNode.unrest()public void drawImplementationSpecificPhysics(com.jme.renderer.Renderer renderer)
protected static PhysicsSpace.Factory getFactory()
PhysicsSpace.Factoryprotected static void setFactory(PhysicsSpace.Factory value)
value - factory for creating PhysicsSpacesPhysicsSpace.Factorypublic static java.util.Set<java.lang.String> getAvailableImplementations()
chooseImplementation(String)public static void chooseImplementation(java.lang.String implementationName)
create().
implementationName - implemntation namegetAvailableImplementations()public static PhysicsSpace create()
public abstract DynamicPhysicsNode createDynamicNode()
public abstract StaticPhysicsNode createStaticNode()
public abstract Joint createJoint()
public abstract void setDirectionalGravity(com.jme.math.Vector3f gravity)
gravity - new gravity in this spacepublic abstract com.jme.math.Vector3f getDirectionalGravity(com.jme.math.Vector3f store)
store - where to store the gravity (null to create a new vector)
protected PhysicsSphere createSphere(java.lang.String name,
PhysicsNode node)
name - name of the Spatialnode - physics node which becomes parent of the geometry, null allowed if implementation supports geoms without a parent
PhysicsCollisionGeometry,
PhysicsSphere
protected PhysicsBox createBox(java.lang.String name,
PhysicsNode node)
name - name of the Spatialnode - physics node which becomes parent of the geometry, null allowed if implementation supports geoms without a parent
PhysicsCollisionGeometry,
PhysicsBox
protected PhysicsCylinder createCylinder(java.lang.String name,
PhysicsNode node)
name - name of the Spatialnode - physics node which becomes parent of the geometry, null allowed if implementation supports geoms without a parent
PhysicsCollisionGeometry,
PhysicsCylinder
protected PhysicsCapsule createCapsule(java.lang.String name,
PhysicsNode node)
name - name of the Spatialnode - physics node which becomes parent of the geometry, null allowed if implementation supports geoms without a parent
PhysicsCollisionGeometry,
PhysicsCapsule
protected PhysicsMesh createMesh(java.lang.String name,
PhysicsNode node)
name - name of the Spatialnode - physics node which becomes parent of the geometry, null allowed if implementation supports geoms without a parent
PhysicsCollisionGeometry,
PhysicsMesh
protected PhysicsRay createRay(java.lang.String name,
PhysicsNode node)
name - name of the Spatialnode - physics node which becomes parent of the geometry, null allowed if implementation supports geoms without a parent
PhysicsCollisionGeometry,
PhysicsRaypublic boolean addToUpdateCallbacks(PhysicsUpdateCallback value)
PhysicsUpdateCallbackprotected PhysicsUpdateCallback getFromUpdateCallbacks(int index)
index - index of element to be retrieved
PhysicsUpdateCallbackpublic void removeAllFromUpdateCallbacks()
PhysicsUpdateCallbackpublic boolean removeFromUpdateCallbacks(PhysicsUpdateCallback value)
PhysicsUpdateCallbackprotected int sizeOfUpdateCallbacks()
PhysicsUpdateCallbackpublic com.jme.input.util.SyntheticButton getCollisionEventHandler()
PhysicsNode.getCollisionEventHandler(),
PhysicsCollisionGeometry.getCollisionEventHandler()protected void collisionEvent(ContactInfo info)
info - info about the collisionpublic void setupBinaryClassLoader(com.jme.util.export.binary.BinaryImporter importer)
public abstract void setAccuracy(float value)
value - value > 0 to indicate accuracy, smaller values mean more accuracyprotected int addCollisionGroup(CollisionGroup value)
value - group to add
protected void removeCollisionGroup(CollisionGroup value)
public java.util.List<? extends CollisionGroup> getCollisionGroups()
CollisionGroups used by this PhysicsSpaceCollisionGrouppublic abstract CollisionGroup createCollisionGroup(java.lang.String name)
CollisionGroup.
name - name of this group (descriptive only)
CollisionGrouppublic abstract CollisionGroup getDefaultCollisionGroup()
getStaticCollisionGroup()public abstract CollisionGroup getStaticCollisionGroup()
getDefaultCollisionGroup().
getDefaultCollisionGroup()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||