When Native Bullet is used with setDebugEnabled, scaled shapes are rendered as if they were unscaled. This can be demonstrated by modifying TestPhysicsRayCast to add the model (and a light source) to the scene:
Spatial s = assetManager.loadModel("Models/Elephant/Elephant.mesh.xml");
s.setLocalScale(0.1f);
rootNode.attachChild(s);
AmbientLight l = new AmbientLight();
rootNode.addLight(l);
With this mod, it's clear that the debug visualization of the rigid body doesn't match the model. But if the model's local scale is set to 1, or if JBullet is used, the visualization matches the model.
The bug seems to be in DebugShapeFactory.getDebugMesh(), which populates a mesh based on an unscaled shape, expecting that the scale will be applied later. However, that scale never gets applied.
When Native Bullet is used with setDebugEnabled, scaled shapes are rendered as if they were unscaled. This can be demonstrated by modifying TestPhysicsRayCast to add the model (and a light source) to the scene:
With this mod, it's clear that the debug visualization of the rigid body doesn't match the model. But if the model's local scale is set to 1, or if JBullet is used, the visualization matches the model.
The bug seems to be in DebugShapeFactory.getDebugMesh(), which populates a mesh based on an unscaled shape, expecting that the scale will be applied later. However, that scale never gets applied.