Skip to content

with Native Bullet, debug mesh ignores scaling of CollisionShape #887

@stephengold

Description

@stephengold

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.

Metadata

Metadata

Assignees

Labels

PhysicsIssues with all kinds of Physics and their BindingsbugSomething that is supposed to work, but doesn't. More severe than a "defect".

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions