Hello.
A BulletAppState has a nice bulletAppState.setDebugEnabled(true); really handy to debug physics. Unfortunately, it doesn't work in VR. Below is a reproductive test case. It's the VR example from the wiki, with 1/ A bullet app state 2/ a green cube, not a blue one, because bullet wireframe view is either pink-ish or blue.
public class MainVRxBulletDebugBug extends SimpleApplication {
public static void main(String[] args) {
AppSettings settings = new AppSettings(true);
settings.put(VRConstants.SETTING_VRAPI, VRConstants.SETTING_VRAPI_OPENVR_LWJGL_VALUE);
settings.put(VRConstants.SETTING_ENABLE_MIRROR_WINDOW, true);
VREnvironment env = new VREnvironment(settings);
env.initialize();
// Checking if the VR environment is well initialized
// (access to the underlying VR system is effective, VR devices are detected).
if (env.isInitialized()){
VRAppState vrAppState = new VRAppState(settings, env);
vrAppState.setMirrorWindowSize(1024, 800);
MainVRxBulletDebugBug app = new MainVRxBulletDebugBug(vrAppState, new BulletAppState());
app.setLostFocusBehavior(LostFocusBehavior.Disabled);
app.setSettings(settings);
app.setShowSettings(false);
app.start();
}
}
public MainVRxBulletDebugBug(AppState... appStates) {
super(appStates);
}
@Override
public void simpleInitApp() {
BulletAppState bulletAppState = getStateManager().getState(BulletAppState.class);
bulletAppState.getPhysicsSpace().setGravity(new Vector3f(0, 2f, 0));
bulletAppState.setDebugEnabled(true);
Box b = new Box(1, 1, 1);
Geometry geom = new Geometry("Box", b);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", ColorRGBA.Green);
geom.setMaterial(mat);
RigidBodyControl rigidBodyControl = new RigidBodyControl(1.0f);
geom.addControl(rigidBodyControl);
bulletAppState.getPhysicsSpace().add(rigidBodyControl);
rootNode.attachChild(geom);
}
}
Hello.
A BulletAppState has a nice
bulletAppState.setDebugEnabled(true);really handy to debug physics. Unfortunately, it doesn't work in VR. Below is a reproductive test case. It's the VR example from the wiki, with 1/ A bullet app state 2/ a green cube, not a blue one, because bullet wireframe view is either pink-ish or blue.