jmonkeyengine: BulletAppState debug not working in VR
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);
}
}
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 23 (14 by maintainers)
Commits related to this issue
- #1795 When in VR attach the debug scene to the two eye's scenes This ensures they show up correctly — committed to richardTingle/jmonkeyengine by richardTingle a year ago
- #1795 Whitespace corrections — committed to richardTingle/jmonkeyengine by richardTingle a year ago
- #1795 Further whitespace corrections — committed to richardTingle/jmonkeyengine by richardTingle a year ago
- #1795 Yet more whitespace corrections — committed to richardTingle/jmonkeyengine by richardTingle a year ago
- #1795 Add explanatory comment as to why VR and non-VR have totally different approaches — committed to richardTingle/jmonkeyengine by richardTingle a year ago
- When in VR attach the debug scene to the two eye's scenes. Fix#1795 (#1888) * #1795 When in VR attach the debug scene to the two eye's scenes This ensures they show up correctly * #1795 Whites... — committed to jMonkeyEngine/jmonkeyengine by richardTingle a year ago
- update (#4) * Android: Implemented AndroidNativeBufferAllocator - Deprecated AndroidBufferAllocator (#1821) * [skip ci] update natives snapshot * Add GL debug capabilities (#1790) * Add GL d... — committed to bob0bob/jmonkeyengine by bob0bob a year ago
I’ve reviewed the changes, and I approve this for integration.