public class BulletAppState extends java.lang.Object implements com.jme3.app.state.AppState, PhysicsTickListener
BulletAppState allows using bullet physics in an Application.| Modifier and Type | Class and Description |
|---|---|
static class |
BulletAppState.ThreadingType |
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
active |
protected com.jme3.app.Application |
app |
protected PhysicsSpace.BroadphaseType |
broadphaseType |
protected BulletDebugAppState |
debugAppState |
protected boolean |
debugEnabled |
protected java.util.concurrent.ScheduledThreadPoolExecutor |
executor |
protected boolean |
initialized |
protected java.util.concurrent.Future |
physicsFuture |
protected PhysicsSpace |
pSpace |
protected float |
speed |
protected com.jme3.app.state.AppStateManager |
stateManager |
protected BulletAppState.ThreadingType |
threadingType |
protected float |
tpf |
protected com.jme3.math.Vector3f |
worldMax |
protected com.jme3.math.Vector3f |
worldMin |
| Constructor and Description |
|---|
BulletAppState()
Creates a new BulletAppState running a PhysicsSpace for physics
simulation, use getStateManager().addState(bulletAppState) to enable
physics for an Application.
|
BulletAppState(PhysicsSpace.BroadphaseType broadphaseType)
Creates a new BulletAppState running a PhysicsSpace for physics
simulation, use getStateManager().addState(bulletAppState) to enable
physics for an Application.
|
BulletAppState(com.jme3.math.Vector3f worldMin,
com.jme3.math.Vector3f worldMax)
Creates a new BulletAppState running a PhysicsSpace for physics
simulation, use getStateManager().addState(bulletAppState) to enable
physics for an Application.
|
BulletAppState(com.jme3.math.Vector3f worldMin,
com.jme3.math.Vector3f worldMax,
PhysicsSpace.BroadphaseType broadphaseType) |
| Modifier and Type | Method and Description |
|---|---|
void |
cleanup() |
PhysicsSpace |
getPhysicsSpace() |
float |
getSpeed() |
BulletAppState.ThreadingType |
getThreadingType() |
void |
initialize(com.jme3.app.state.AppStateManager stateManager,
com.jme3.app.Application app) |
boolean |
isDebugEnabled() |
boolean |
isEnabled() |
boolean |
isInitialized() |
void |
physicsTick(PhysicsSpace space,
float f)
Called after the physics has been stepped, use to check for forces etc.
|
void |
postRender() |
void |
prePhysicsTick(PhysicsSpace space,
float f)
Called before the physics is actually stepped, use to apply forces etc.
|
void |
render(com.jme3.renderer.RenderManager rm) |
void |
setBroadphaseType(PhysicsSpace.BroadphaseType broadphaseType)
Use before attaching state
|
void |
setDebugEnabled(boolean debugEnabled) |
void |
setEnabled(boolean enabled) |
void |
setSpeed(float speed) |
void |
setThreadingType(BulletAppState.ThreadingType threadingType)
Use before attaching state
|
void |
setWorldMax(com.jme3.math.Vector3f worldMax)
Use before attaching state
|
void |
setWorldMin(com.jme3.math.Vector3f worldMin)
Use before attaching state
|
void |
startPhysics()
The physics system is started automatically on attaching, if you want to
start it before for some reason, you can use this method.
|
void |
stateAttached(com.jme3.app.state.AppStateManager stateManager) |
void |
stateDetached(com.jme3.app.state.AppStateManager stateManager) |
void |
stopPhysics() |
void |
update(float tpf) |
protected boolean initialized
protected com.jme3.app.Application app
protected com.jme3.app.state.AppStateManager stateManager
protected java.util.concurrent.ScheduledThreadPoolExecutor executor
protected PhysicsSpace pSpace
protected BulletAppState.ThreadingType threadingType
protected PhysicsSpace.BroadphaseType broadphaseType
protected com.jme3.math.Vector3f worldMin
protected com.jme3.math.Vector3f worldMax
protected float speed
protected boolean active
protected boolean debugEnabled
protected BulletDebugAppState debugAppState
protected float tpf
protected java.util.concurrent.Future physicsFuture
public BulletAppState()
public BulletAppState(PhysicsSpace.BroadphaseType broadphaseType)
broadphaseType - The type of broadphase collision detection,
BroadphaseType.DVBT is the defaultpublic BulletAppState(com.jme3.math.Vector3f worldMin,
com.jme3.math.Vector3f worldMax)
worldMin - The minimum world extentworldMax - The maximum world extentpublic BulletAppState(com.jme3.math.Vector3f worldMin,
com.jme3.math.Vector3f worldMax,
PhysicsSpace.BroadphaseType broadphaseType)
public PhysicsSpace getPhysicsSpace()
public void startPhysics()
public void stopPhysics()
public void initialize(com.jme3.app.state.AppStateManager stateManager,
com.jme3.app.Application app)
initialize in interface com.jme3.app.state.AppStatepublic boolean isInitialized()
isInitialized in interface com.jme3.app.state.AppStatepublic void setEnabled(boolean enabled)
setEnabled in interface com.jme3.app.state.AppStatepublic boolean isEnabled()
isEnabled in interface com.jme3.app.state.AppStatepublic void setDebugEnabled(boolean debugEnabled)
public boolean isDebugEnabled()
public void stateAttached(com.jme3.app.state.AppStateManager stateManager)
stateAttached in interface com.jme3.app.state.AppStatepublic void stateDetached(com.jme3.app.state.AppStateManager stateManager)
stateDetached in interface com.jme3.app.state.AppStatepublic void update(float tpf)
update in interface com.jme3.app.state.AppStatepublic void render(com.jme3.renderer.RenderManager rm)
render in interface com.jme3.app.state.AppStatepublic void postRender()
postRender in interface com.jme3.app.state.AppStatepublic void cleanup()
cleanup in interface com.jme3.app.state.AppStatepublic BulletAppState.ThreadingType getThreadingType()
public void setThreadingType(BulletAppState.ThreadingType threadingType)
threadingType - the threadingType to setpublic void setBroadphaseType(PhysicsSpace.BroadphaseType broadphaseType)
public void setWorldMin(com.jme3.math.Vector3f worldMin)
public void setWorldMax(com.jme3.math.Vector3f worldMax)
public float getSpeed()
public void setSpeed(float speed)
public void prePhysicsTick(PhysicsSpace space, float f)
PhysicsTickListenerprePhysicsTick in interface PhysicsTickListenerspace - the physics spacef - the time per frame in secondspublic void physicsTick(PhysicsSpace space, float f)
PhysicsTickListenerphysicsTick in interface PhysicsTickListenerspace - the physics spacef - the time per frame in seconds