Package com.jme3.bullet.debug
Class BulletDebugAppState
java.lang.Object
com.jme3.app.state.BaseAppState
com.jme3.bullet.debug.BulletDebugAppState
- All Implemented Interfaces:
com.jme3.app.state.AppState
- Direct Known Subclasses:
MultiBodyDebugAppState
,SoftDebugAppState
public class BulletDebugAppState
extends com.jme3.app.state.BaseAppState
An AppState to manage debug visualization of a PhysicsSpace.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Interface to restrict which physics objects are visualized. -
Field Summary
Modifier and TypeFieldDescriptionstatic final com.jme3.material.Material
fake Material to indicate child coloring of a CompoundCollisionShapestatic final Logger
message logger for this class -
Constructor Summary
ConstructorDescriptionInstantiate an AppState with the specified configuration. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
attachChild
(com.jme3.scene.Spatial spatial) Attach the specified Spatial to the debug root node.protected void
cleanup
(com.jme3.app.Application app) Transition this state from terminating to detached.protected com.jme3.material.Material
createWireMaterial
(com.jme3.asset.AssetManager assetManager, com.jme3.math.ColorRGBA color, String name, int numSides) Create the specified wireframe material.protected HashMap<PhysicsCollisionObject,
com.jme3.scene.Node> Access the map from collision objects to transformed visualization nodes.com.jme3.scene.Node
Access the Node containing all the debug visualization.void
initialize
(com.jme3.app.Application app) Initialize this state prior to its first update.protected void
Transition this state from enabled to disabled.protected void
onEnable()
Transition this state from disabled to enabled.void
render
(com.jme3.renderer.RenderManager rm) Render this state.void
Alter which angular velocities are visualized.void
Alter which bounding boxes are visualized.void
Alter which physics objects are visualized.void
Alter which gravity vectors are visualized.void
setJointLineWidth
(float width) Alter the line width for PhysicsJoint arrows.void
Alter which swept spheres are visualized.protected void
setupMaterials
(com.jme3.asset.AssetManager am) Initialize the wireframe materials and child materials.void
Alter which velocity vectors are visualized.void
update
(float tpf) Update this state prior to rendering.protected void
updateAxes
(com.jme3.scene.Node node, boolean displayShape) Update the AxesVisualizer for the specified Node.protected void
Synchronize the collision-shape debug controls and axis visualizers with the collision objects in the PhysicsSpace.protected void
Synchronize the velocity visualizers with the collision objects in the PhysicsSpace.Methods inherited from class com.jme3.app.state.BaseAppState
cleanup, getApplication, getId, getState, getState, getState, getState, getStateManager, initialize, isEnabled, isInitialized, postRender, setEnabled, setId, stateAttached, stateDetached
-
Field Details
-
logger
message logger for this class -
enableChildColoring
public static final com.jme3.material.Material enableChildColoringfake Material to indicate child coloring of a CompoundCollisionShape
-
-
Constructor Details
-
BulletDebugAppState
Instantiate an AppState with the specified configuration. This constructor should be invoked only by BulletAppState.- Parameters:
config
- the desired configuration (not null, alias created)
-
-
Method Details
-
getRootNode
public com.jme3.scene.Node getRootNode()Access the Node containing all the debug visualization.- Returns:
- the pre-existing instance, or null if unknown
-
setAngularVelocityFilter
Alter which angular velocities are visualized. For internal use only.- Parameters:
filter
- the desired filter, or null to visualize no angular velocities
-
setBoundingBoxFilter
Alter which bounding boxes are visualized. For internal use only.- Parameters:
filter
- the desired filter, or null to visualize no bounding boxes
-
setFilter
Alter which physics objects are visualized. For compatibility with the jme3-jbullet library.- Parameters:
filter
- the desired filter (alias created) or null to visualize all objects
-
setGravityVectorFilter
Alter which gravity vectors are visualized. For internal use only.- Parameters:
filter
- the desired filter (alias created) or null to visualize no gravity vectors
-
setJointLineWidth
public void setJointLineWidth(float width) Alter the line width for PhysicsJoint arrows. For internal use only.- Parameters:
width
- (in pixels, ≥1, default=1)
-
setSweptSphereFilter
Alter which swept spheres are visualized. For internal use only.- Parameters:
filter
- the desired filter, or null to visualize no swept spheres
-
setVelocityVectorFilter
Alter which velocity vectors are visualized. For internal use only.- Parameters:
filter
- the desired filter, or null to visualize no velocity vectors
-
attachChild
protected void attachChild(com.jme3.scene.Spatial spatial) Attach the specified Spatial to the debug root node.- Parameters:
spatial
- the Spatial to attach (not null)
-
createWireMaterial
protected com.jme3.material.Material createWireMaterial(com.jme3.asset.AssetManager assetManager, com.jme3.math.ColorRGBA color, String name, int numSides) Create the specified wireframe material.- Parameters:
assetManager
- the application's AssetManager (not null)color
- the desired color (not null, unaffected)name
- the desired name for the MaterialnumSides
- the desired number of sides (1 or 2)- Returns:
- a new instance
-
getPcoMap
Access the map from collision objects to transformed visualization nodes.- Returns:
- the pre-existing instance
-
setupMaterials
protected void setupMaterials(com.jme3.asset.AssetManager am) Initialize the wireframe materials and child materials.- Parameters:
am
- the application's AssetManager (not null)
-
updateAxes
protected void updateAxes(com.jme3.scene.Node node, boolean displayShape) Update the AxesVisualizer for the specified Node.- Parameters:
node
- the transformed Node to update (not null)displayShape
- true shape is visualized, otherwise false
-
updateShapes
protected void updateShapes()Synchronize the collision-shape debug controls and axis visualizers with the collision objects in the PhysicsSpace. -
updateVelocities
protected void updateVelocities()Synchronize the velocity visualizers with the collision objects in the PhysicsSpace. -
cleanup
protected void cleanup(com.jme3.app.Application app) Transition this state from terminating to detached. Should be invoked only by a subclass or by the AppStateManager.Invoked once for each time
BaseAppState.initialize(com.jme3.app.state.AppStateManager, com.jme3.app.Application)
is invoked.- Specified by:
cleanup
in classcom.jme3.app.state.BaseAppState
- Parameters:
app
- the application which owns this state (not null)
-
initialize
public void initialize(com.jme3.app.Application app) Initialize this state prior to its first update. Should be invoked only by a subclass or by the AppStateManager.- Specified by:
initialize
in classcom.jme3.app.state.BaseAppState
- Parameters:
app
- the application which owns this state (not null)
-
onDisable
protected void onDisable()Transition this state from enabled to disabled.- Specified by:
onDisable
in classcom.jme3.app.state.BaseAppState
-
onEnable
protected void onEnable()Transition this state from disabled to enabled.- Specified by:
onEnable
in classcom.jme3.app.state.BaseAppState
-
render
public void render(com.jme3.renderer.RenderManager rm) Render this state. Should be invoked only by a subclass or by the AppStateManager. Invoked once per frame, provided the state is attached and enabled.- Specified by:
render
in interfacecom.jme3.app.state.AppState
- Overrides:
render
in classcom.jme3.app.state.BaseAppState
- Parameters:
rm
- the render manager (not null)
-
update
public void update(float tpf) Update this state prior to rendering. Should be invoked only by a subclass or by the AppStateManager. Invoked once per frame, provided the state is attached and enabled.- Specified by:
update
in interfacecom.jme3.app.state.AppState
- Overrides:
update
in classcom.jme3.app.state.BaseAppState
- Parameters:
tpf
- the time interval between frames (in seconds, ≥0)
-