com.jme3.bullet
クラス PhysicsSpace

java.lang.Object
  上位を拡張 com.jme3.bullet.PhysicsSpace

public class PhysicsSpace
extends java.lang.Object

PhysicsSpace - The central jbullet-jme physics space


入れ子のクラスの概要
static class PhysicsSpace.BroadphaseType
          interface with Broadphase types
 
フィールドの概要
static int AXIS_X
           
static int AXIS_Y
           
static int AXIS_Z
           
 
コンストラクタの概要
PhysicsSpace()
           
PhysicsSpace(PhysicsSpace.BroadphaseType broadphaseType)
           
PhysicsSpace(Vector3f worldMin, Vector3f worldMax)
           
PhysicsSpace(Vector3f worldMin, Vector3f worldMax, PhysicsSpace.BroadphaseType broadphaseType)
           
 
メソッドの概要
 void add(java.lang.Object obj)
          adds an object to the physics space
 void addAll(Spatial spatial)
          adds all physics controls and joints in the given spatial node to the physics space (e.g. after loading from disk) - recursive if node
 void addCollisionGroupListener(PhysicsCollisionGroupListener listener, int collisionGroup)
          Adds a listener for a specific collision group, such a listener can disable collisions when they happen.
 void addCollisionListener(PhysicsCollisionListener listener)
          Adds a CollisionListener that will be informed about collision events
 void addCollisionObject(PhysicsCollisionObject obj)
           
 void addTickListener(PhysicsTickListener listener)
          Adds the specified listener to the physics tick listeners.
 void applyGravity()
          applies gravity value to all objects
 void clearForces()
          clears forces of all objects
 void create()
          Has to be called from the (designated) physics thread
 void destroy()
          destroys the current PhysicsSpace so that a new one can be created
 void disableDebug()
          Disable debug display
 void distributeEvents()
           
 void enableDebug(AssetManager manager)
          Enable debug display for physics
<V> java.util.concurrent.Future<V>
enqueue(java.util.concurrent.Callable<V> callable)
          calls the callable on the next physics tick (ensuring e.g. force applying)
static
<V> java.util.concurrent.Future<V>
enqueueOnThisThread(java.util.concurrent.Callable<V> callable)
           
 float getAccuracy()
          get the current accuracy of the physics computation
 PhysicsSpace.BroadphaseType getBroadphaseType()
           
 AssetManager getDebugManager()
           
 com.bulletphysics.dynamics.DynamicsWorld getDynamicsWorld()
          used internally
static PhysicsSpace getPhysicsSpace()
          Get the current PhysicsSpace running on this thread
For parallel physics, this can also be called from the OpenGL thread to receive the PhysicsSpace
 Vector3f getWorldMax()
           
 Vector3f getWorldMin()
           
 java.util.List<PhysicsRayTestResult> rayTest(Vector3f from, Vector3f to)
          Performs a ray collision test and returns the results as a list of PhysicsRayTestResults
 java.util.List<PhysicsRayTestResult> rayTest(Vector3f from, Vector3f to, java.util.List<PhysicsRayTestResult> results)
          Performs a ray collision test and returns the results as a list of PhysicsRayTestResults
 void remove(java.lang.Object obj)
          removes an object from the physics space
 void removeAll(Spatial spatial)
          Removes all physics controls and joints in the given spatial from the physics space (e.g. before saving to disk) - recursive if node
 void removeCollisionGroupListener(int collisionGroup)
           
 void removeCollisionListener(PhysicsCollisionListener listener)
          Removes a CollisionListener from the list
 void removeCollisionObject(PhysicsCollisionObject obj)
           
 void removeTickListener(PhysicsTickListener listener)
           
 void setAccuracy(float accuracy)
          sets the accuracy of the physics computation, default=1/60s
 void setBroadphaseType(PhysicsSpace.BroadphaseType broadphaseType)
           
 void setGravity(Vector3f gravity)
          Sets the gravity of the PhysicsSpace, set before adding physics objects!
static void setLocalThreadPhysicsSpace(PhysicsSpace space)
          Used internally
 void setMaxSubSteps(int steps)
          Sets the maximum amount of extra steps that will be used to step the physics when the fps is below the physics fps.
 void setWorldMax(Vector3f worldMax)
          only applies for AXIS_SWEEP broadphase
 void setWorldMin(Vector3f worldMin)
          only applies for AXIS_SWEEP broadphase
 java.util.List<PhysicsSweepTestResult> sweepTest(CollisionShape shape, Transform start, Transform end)
          Performs a sweep collision test and returns the results as a list of PhysicsSweepTestResults
You have to use different Transforms for start and end (at least distance > 0.4f).
 java.util.List<PhysicsSweepTestResult> sweepTest(CollisionShape shape, Transform start, Transform end, java.util.List<PhysicsSweepTestResult> results)
          Performs a sweep collision test and returns the results as a list of PhysicsSweepTestResults
You have to use different Transforms for start and end (at least distance > 0.4f).
 void update(float time)
          updates the physics space
 void update(float time, int maxSteps)
          updates the physics space, uses maxSteps
 
クラス java.lang.Object から継承されたメソッド
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

AXIS_X

public static final int AXIS_X
関連項目:
定数フィールド値

AXIS_Y

public static final int AXIS_Y
関連項目:
定数フィールド値

AXIS_Z

public static final int AXIS_Z
関連項目:
定数フィールド値
コンストラクタの詳細

PhysicsSpace

public PhysicsSpace()

PhysicsSpace

public PhysicsSpace(PhysicsSpace.BroadphaseType broadphaseType)

PhysicsSpace

public PhysicsSpace(Vector3f worldMin,
                    Vector3f worldMax)

PhysicsSpace

public PhysicsSpace(Vector3f worldMin,
                    Vector3f worldMax,
                    PhysicsSpace.BroadphaseType broadphaseType)
メソッドの詳細

getPhysicsSpace

public static PhysicsSpace getPhysicsSpace()
Get the current PhysicsSpace running on this thread
For parallel physics, this can also be called from the OpenGL thread to receive the PhysicsSpace

戻り値:
the PhysicsSpace running on this thread

setLocalThreadPhysicsSpace

public static void setLocalThreadPhysicsSpace(PhysicsSpace space)
Used internally

パラメータ:
space -

create

public void create()
Has to be called from the (designated) physics thread


update

public void update(float time)
updates the physics space

パラメータ:
time - the current time value

update

public void update(float time,
                   int maxSteps)
updates the physics space, uses maxSteps

パラメータ:
time - the current time value
maxSteps -

distributeEvents

public void distributeEvents()

enqueueOnThisThread

public static <V> java.util.concurrent.Future<V> enqueueOnThisThread(java.util.concurrent.Callable<V> callable)

enqueue

public <V> java.util.concurrent.Future<V> enqueue(java.util.concurrent.Callable<V> callable)
calls the callable on the next physics tick (ensuring e.g. force applying)

型パラメータ:
V -
パラメータ:
callable -
戻り値:

add

public void add(java.lang.Object obj)
adds an object to the physics space

パラメータ:
obj - the PhysicsControl or Spatial with PhysicsControl to add

addCollisionObject

public void addCollisionObject(PhysicsCollisionObject obj)

remove

public void remove(java.lang.Object obj)
removes an object from the physics space

パラメータ:
obj - the PhysicsControl or Spatial with PhysicsControl to remove

removeCollisionObject

public void removeCollisionObject(PhysicsCollisionObject obj)

addAll

public void addAll(Spatial spatial)
adds all physics controls and joints in the given spatial node to the physics space (e.g. after loading from disk) - recursive if node

パラメータ:
spatial - the rootnode containing the physics objects

removeAll

public void removeAll(Spatial spatial)
Removes all physics controls and joints in the given spatial from the physics space (e.g. before saving to disk) - recursive if node

パラメータ:
spatial - the rootnode containing the physics objects

setGravity

public void setGravity(Vector3f gravity)
Sets the gravity of the PhysicsSpace, set before adding physics objects!

パラメータ:
gravity -

applyGravity

public void applyGravity()
applies gravity value to all objects


clearForces

public void clearForces()
clears forces of all objects


addTickListener

public void addTickListener(PhysicsTickListener listener)
Adds the specified listener to the physics tick listeners. The listeners are called on each physics step, which is not necessarily each frame but is determined by the accuracy of the physics space.

パラメータ:
listener -

removeTickListener

public void removeTickListener(PhysicsTickListener listener)

addCollisionListener

public void addCollisionListener(PhysicsCollisionListener listener)
Adds a CollisionListener that will be informed about collision events

パラメータ:
listener - the CollisionListener to add

removeCollisionListener

public void removeCollisionListener(PhysicsCollisionListener listener)
Removes a CollisionListener from the list

パラメータ:
listener - the CollisionListener to remove

addCollisionGroupListener

public void addCollisionGroupListener(PhysicsCollisionGroupListener listener,
                                      int collisionGroup)
Adds a listener for a specific collision group, such a listener can disable collisions when they happen.
There can be only one listener per collision group.

パラメータ:
listener -
collisionGroup -

removeCollisionGroupListener

public void removeCollisionGroupListener(int collisionGroup)

rayTest

public java.util.List<PhysicsRayTestResult> rayTest(Vector3f from,
                                                    Vector3f to)
Performs a ray collision test and returns the results as a list of PhysicsRayTestResults


rayTest

public java.util.List<PhysicsRayTestResult> rayTest(Vector3f from,
                                                    Vector3f to,
                                                    java.util.List<PhysicsRayTestResult> results)
Performs a ray collision test and returns the results as a list of PhysicsRayTestResults


sweepTest

public java.util.List<PhysicsSweepTestResult> sweepTest(CollisionShape shape,
                                                        Transform start,
                                                        Transform end)
Performs a sweep collision test and returns the results as a list of PhysicsSweepTestResults
You have to use different Transforms for start and end (at least distance > 0.4f). SweepTest will not see a collision if it starts INSIDE an object and is moving AWAY from its center.


sweepTest

public java.util.List<PhysicsSweepTestResult> sweepTest(CollisionShape shape,
                                                        Transform start,
                                                        Transform end,
                                                        java.util.List<PhysicsSweepTestResult> results)
Performs a sweep collision test and returns the results as a list of PhysicsSweepTestResults
You have to use different Transforms for start and end (at least distance > 0.4f). SweepTest will not see a collision if it starts INSIDE an object and is moving AWAY from its center.


destroy

public void destroy()
destroys the current PhysicsSpace so that a new one can be created


getDynamicsWorld

public com.bulletphysics.dynamics.DynamicsWorld getDynamicsWorld()
used internally

戻り値:
the dynamicsWorld

getBroadphaseType

public PhysicsSpace.BroadphaseType getBroadphaseType()

setBroadphaseType

public void setBroadphaseType(PhysicsSpace.BroadphaseType broadphaseType)

setMaxSubSteps

public void setMaxSubSteps(int steps)
Sets the maximum amount of extra steps that will be used to step the physics when the fps is below the physics fps. Doing this maintains determinism in physics. For example a maximum number of 2 can compensate for framerates as low as 30fps when the physics has the default accuracy of 60 fps. Note that setting this value too high can make the physics drive down its own fps in case its overloaded.

パラメータ:
steps - The maximum number of extra steps, default is 4.

getAccuracy

public float getAccuracy()
get the current accuracy of the physics computation

戻り値:
the current accuracy

setAccuracy

public void setAccuracy(float accuracy)
sets the accuracy of the physics computation, default=1/60s

パラメータ:
accuracy -

getWorldMin

public Vector3f getWorldMin()

setWorldMin

public void setWorldMin(Vector3f worldMin)
only applies for AXIS_SWEEP broadphase

パラメータ:
worldMin -

getWorldMax

public Vector3f getWorldMax()

setWorldMax

public void setWorldMax(Vector3f worldMax)
only applies for AXIS_SWEEP broadphase

パラメータ:
worldMax -

enableDebug

public void enableDebug(AssetManager manager)
Enable debug display for physics

パラメータ:
manager - AssetManager to use to create debug materials

disableDebug

public void disableDebug()
Disable debug display


getDebugManager

public AssetManager getDebugManager()