public class PhysicsSpace
extends java.lang.Object
PhysicsSpace - The central jbullet-jme physics space
| Modifier and Type | Class and Description |
|---|---|
static class |
PhysicsSpace.BroadphaseType
interface with Broadphase types
|
| Modifier and Type | Field and Description |
|---|---|
static int |
AXIS_X |
static int |
AXIS_Y |
static int |
AXIS_Z |
| Constructor and Description |
|---|
PhysicsSpace() |
PhysicsSpace(PhysicsSpace.BroadphaseType broadphaseType) |
PhysicsSpace(com.jme3.math.Vector3f worldMin,
com.jme3.math.Vector3f worldMax) |
PhysicsSpace(com.jme3.math.Vector3f worldMin,
com.jme3.math.Vector3f worldMax,
PhysicsSpace.BroadphaseType broadphaseType) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(java.lang.Object obj)
adds an object to the physics space
|
void |
addAll(com.jme3.scene.Spatial spatial)
adds all physics controls and joints in the given spatial node to the physics space
(e.g.
|
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. |
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 |
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 |
distributeEvents() |
<V> java.util.concurrent.Future<V> |
enqueue(java.util.concurrent.Callable<V> callable)
calls the callable on the next physics tick (ensuring e.g.
|
static <V> java.util.concurrent.Future<V> |
enqueueOnThisThread(java.util.concurrent.Callable<V> callable) |
protected void |
finalize() |
float |
getAccuracy()
get the current accuracy of the physics computation
|
PhysicsSpace.BroadphaseType |
getBroadphaseType() |
java.util.Collection<PhysicsCharacter> |
getCharacterList() |
java.util.Collection<PhysicsGhostObject> |
getGhostObjectList() |
com.jme3.math.Vector3f |
getGravity(com.jme3.math.Vector3f gravity) |
java.util.Collection<PhysicsJoint> |
getJointList() |
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 |
int |
GetRayTestFlags()
Gets m_flags for raytest, see https://code.google.com/p/bullet/source/browse/trunk/src/BulletCollision/NarrowPhaseCollision/btRaycastCallback.h
for possible options.
|
java.util.Collection<PhysicsRigidBody> |
getRigidBodyList() |
int |
getSolverNumIterations()
Get the number of iterations used by the contact solver.
|
long |
getSpaceId()
// * used internally //
|
java.util.Collection<PhysicsVehicle> |
getVehicleList() |
com.jme3.math.Vector3f |
getWorldMax() |
com.jme3.math.Vector3f |
getWorldMin() |
static void |
initNativePhysics() |
void |
rayTest_native(com.jme3.math.Vector3f from,
com.jme3.math.Vector3f to,
long physicsSpaceId,
java.util.List<PhysicsRayTestResult> results,
int flags) |
java.util.List |
rayTest(com.jme3.math.Vector3f from,
com.jme3.math.Vector3f to)
Performs a ray collision test and returns the results as a list of
PhysicsRayTestResults
|
java.util.List<PhysicsRayTestResult> |
rayTest(com.jme3.math.Vector3f from,
com.jme3.math.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(com.jme3.scene.Spatial spatial)
Removes all physics controls and joints in the given spatial from the physics space
(e.g.
|
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(com.jme3.math.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 |
SetRayTestFlags(int flags)
Sets m_flags for raytest, see https://code.google.com/p/bullet/source/browse/trunk/src/BulletCollision/NarrowPhaseCollision/btRaycastCallback.h
for possible options.
|
void |
setSolverNumIterations(int numIterations)
Set the number of iterations used by the contact solver.
|
void |
setWorldMax(com.jme3.math.Vector3f worldMax)
only applies for AXIS_SWEEP broadphase
|
void |
setWorldMin(com.jme3.math.Vector3f worldMin)
only applies for AXIS_SWEEP broadphase
|
void |
sweepTest_native(long shape,
com.jme3.math.Transform from,
com.jme3.math.Transform to,
long physicsSpaceId,
java.util.List<PhysicsSweepTestResult> results,
float allowedCcdPenetration) |
java.util.List<PhysicsSweepTestResult> |
sweepTest(CollisionShape shape,
com.jme3.math.Transform start,
com.jme3.math.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,
com.jme3.math.Transform start,
com.jme3.math.Transform end,
java.util.List<PhysicsSweepTestResult> results) |
java.util.List<PhysicsSweepTestResult> |
sweepTest(CollisionShape shape,
com.jme3.math.Transform start,
com.jme3.math.Transform end,
java.util.List<PhysicsSweepTestResult> results,
float allowedCcdPenetration)
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 > allowedCcdPenetration). |
void |
update(float time)
updates the physics space
|
void |
update(float time,
int maxSteps)
updates the physics space, uses maxSteps
|
public static final int AXIS_X
public static final int AXIS_Y
public static final int AXIS_Z
public PhysicsSpace()
public PhysicsSpace(PhysicsSpace.BroadphaseType broadphaseType)
public PhysicsSpace(com.jme3.math.Vector3f worldMin,
com.jme3.math.Vector3f worldMax)
public PhysicsSpace(com.jme3.math.Vector3f worldMin,
com.jme3.math.Vector3f worldMax,
PhysicsSpace.BroadphaseType broadphaseType)
public static PhysicsSpace getPhysicsSpace()
public static void setLocalThreadPhysicsSpace(PhysicsSpace space)
space - public void create()
public void update(float time)
time - the current time valuepublic void update(float time,
int maxSteps)
time - the current time valuemaxSteps - public void distributeEvents()
public static <V> java.util.concurrent.Future<V> enqueueOnThisThread(java.util.concurrent.Callable<V> callable)
public <V> java.util.concurrent.Future<V> enqueue(java.util.concurrent.Callable<V> callable)
V - callable - public void add(java.lang.Object obj)
obj - the PhysicsControl or Spatial with PhysicsControl to addpublic void addCollisionObject(PhysicsCollisionObject obj)
public void remove(java.lang.Object obj)
obj - the PhysicsControl or Spatial with PhysicsControl to removepublic void removeCollisionObject(PhysicsCollisionObject obj)
public void addAll(com.jme3.scene.Spatial spatial)
spatial - the rootnode containing the physics objectspublic void removeAll(com.jme3.scene.Spatial spatial)
spatial - the rootnode containing the physics objectspublic java.util.Collection<PhysicsRigidBody> getRigidBodyList()
public java.util.Collection<PhysicsGhostObject> getGhostObjectList()
public java.util.Collection<PhysicsCharacter> getCharacterList()
public java.util.Collection<PhysicsJoint> getJointList()
public java.util.Collection<PhysicsVehicle> getVehicleList()
public void setGravity(com.jme3.math.Vector3f gravity)
gravity - public com.jme3.math.Vector3f getGravity(com.jme3.math.Vector3f gravity)
public void addTickListener(PhysicsTickListener listener)
listener - public void removeTickListener(PhysicsTickListener listener)
public void addCollisionListener(PhysicsCollisionListener listener)
listener - the CollisionListener to addpublic void removeCollisionListener(PhysicsCollisionListener listener)
listener - the CollisionListener to removepublic void addCollisionGroupListener(PhysicsCollisionGroupListener listener, int collisionGroup)
listener - collisionGroup - public void removeCollisionGroupListener(int collisionGroup)
public java.util.List rayTest(com.jme3.math.Vector3f from,
com.jme3.math.Vector3f to)
public void SetRayTestFlags(int flags)
public int GetRayTestFlags()
public java.util.List<PhysicsRayTestResult> rayTest(com.jme3.math.Vector3f from, com.jme3.math.Vector3f to, java.util.List<PhysicsRayTestResult> results)
public void rayTest_native(com.jme3.math.Vector3f from,
com.jme3.math.Vector3f to,
long physicsSpaceId,
java.util.List<PhysicsRayTestResult> results,
int flags)
public java.util.List<PhysicsSweepTestResult> sweepTest(CollisionShape shape, com.jme3.math.Transform start, com.jme3.math.Transform end)
public java.util.List<PhysicsSweepTestResult> sweepTest(CollisionShape shape, com.jme3.math.Transform start, com.jme3.math.Transform end, java.util.List<PhysicsSweepTestResult> results)
public void sweepTest_native(long shape,
com.jme3.math.Transform from,
com.jme3.math.Transform to,
long physicsSpaceId,
java.util.List<PhysicsSweepTestResult> results,
float allowedCcdPenetration)
public java.util.List<PhysicsSweepTestResult> sweepTest(CollisionShape shape, com.jme3.math.Transform start, com.jme3.math.Transform end, java.util.List<PhysicsSweepTestResult> results, float allowedCcdPenetration)
public void destroy()
public long getSpaceId()
public PhysicsSpace.BroadphaseType getBroadphaseType()
public void setBroadphaseType(PhysicsSpace.BroadphaseType broadphaseType)
public void setMaxSubSteps(int steps)
steps - The maximum number of extra steps, default is 4.public float getAccuracy()
public void setAccuracy(float accuracy)
accuracy - public com.jme3.math.Vector3f getWorldMin()
public void setWorldMin(com.jme3.math.Vector3f worldMin)
worldMin - public com.jme3.math.Vector3f getWorldMax()
public void setWorldMax(com.jme3.math.Vector3f worldMax)
worldMax - public void setSolverNumIterations(int numIterations)
numIterations - The number of iterations used by the contact & constraint solver.public int getSolverNumIterations()
public static void initNativePhysics()
protected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwable