Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collider debug lines are rendered behind the model #345

Open
MatrixDev opened this issue Mar 17, 2023 · 8 comments
Open

Collider debug lines are rendered behind the model #345

MatrixDev opened this issue Mar 17, 2023 · 8 comments
Labels
A-Integration very bevy specific C-Bug Something isn't working D-Easy P-Medium S-not-started Work has not started

Comments

@MatrixDev
Copy link

For some reason collider debug lines are always rendered behind geometry. This is especially bad when "ground" mesh is present because it completely covers debug lines.

Regular plugins init:

.add_plugin(RapierDebugRenderPlugin {
    enabled: true,
    always_on_top: true,
    ..default()
})

Adding rapier stuff when scene is loaded (in my case I need to add it only after snene is available):

commands.entity(entity)
            .insert(RigidBody::Fixed)
            .insert(Collider::cuboid(1.0, 0.5, 1.0))
            .insert(ColliderDebugColor(Color::CYAN))
            .insert(SceneBundle { scene: hull.default_scene.clone().unwrap(), ..default() })

And here is a result:

Screen.Recording.2023-03-17.at.13.40.09.mov
@MatrixDev
Copy link
Author

Here is an example when terrain is present:

out.mp4

@devmitch
Copy link

devmitch commented May 8, 2023

Looks like this is already fixed as of #340 , so you could use the master branch until 0.22 is released.

@toolness
Copy link

toolness commented Jun 6, 2023

As far as I can tell, @devmitch is right. #366 was filed as an attempt to fix this issue but I can't find any difference between the current master branch and that PR. For more details on my testing, see #366 (comment).

So my recommendation (unless my testing is missing some kind of edge case that #366 addresses) is to close both this issue and #366.

@toolness
Copy link

toolness commented Jun 6, 2023

That said, always_on_top not working does seem like a fairly major bug, so maybe a new release should be made soon? Or perhaps #340 can be back-ported and a 0.21.1 bugfix release can be made?

@toolness
Copy link

toolness commented Jun 6, 2023

Actually, wait... something dreadfully wrong is happening with 0.21.0, even when always_on_top is false.

I've borrowed from the "getting started" instructions and added a falling bouncing ball to my project, which already has some 3d scenery.

On the latest master branch, with always_on_top disabled, I can see the bouncing ball in full view as it falls to the ground:

image

Once it lands and stops bouncing, it's partially obscured by a barrel:

image

On 0.21.0, however, this physics object initially appears behind the wall as it falls to the ground, and once at rest, it seems to disappear entirely (even when I move my camera past the wall the ball was behind). Here's a screenshot as it's falling to the ground:

image

So it seems that more than just always_on_top has been fixed since 0.21.0. I imagine a new release would be much appreciated by rapier newcomers like me!

@Ynng
Copy link

Ynng commented Jun 20, 2023

So it seems that more than just always_on_top has been fixed since 0.21.0. I imagine a new release would be much appreciated by rapier newcomers like me!

You mean broken?

I'm getting the same behavior on 0.21.0, where the debug renders go behind everything else, even in cases where it is closer to the camera.

@toolness
Copy link

Update: since the release of bevy_rapier 0.22 (specifically #380), always_on_top is no longer available because Bevy 0.11's new Gizmos system is being used to draw the debug mode.

To achieve the same effect, it looks like we can use the depth_bias property of GizmoConfig, e.g.:

app.insert_resource(GizmoConfig {
    depth_bias: -1.0,
    ..Default::default()
})

That said, I'm experiencing some weird bugs, e.g. when a collider's gizmo line extends from off-camera to on-camera, it sometimes isn't drawn... Not sure if this is a bug in bevy_rapier or bevy's new gizmo system.

toolness added a commit to toolness/bevy-dungeon-fun that referenced this issue Jul 15, 2023
As per the instructions in https://bevyengine.org/learn/migration-guides/0.10-0.11/.

## Notes

* `bevy_rapier`'s new Gizmo-based debug renderer seems buggy, as lines seem to disappear when parts of them are off-camera.  I mentioned this in dimforge/bevy_rapier#345 (comment).

* It seems that all of my Blender scene's wall colliders going along the Y axis in Blender had a non-uniform scale applied to them.  Previously this seemed to pose no problem (or perhaps it was a problem of a different kind that I never noticed) but the new versions of the dependencies appear to ignore the non-uniform scale, which caused problems, so I applied the scale in the scene to make it all uniform (afe2a78).

* Spawning the player at the origin made them get stuck in the floor on respawn.  Not sure exactly why this was happening (perhaps weird system ordering) but nudging the start position to be slightly above the ground fixed this (238e8d1).
@Vrixyz Vrixyz added C-Bug Something isn't working D-Easy P-Medium S-not-started Work has not started A-Integration very bevy specific labels May 23, 2024
@Vrixyz
Copy link
Contributor

Vrixyz commented May 23, 2024

I suspect that's fixed now ? Keeping open until verified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Integration very bevy specific C-Bug Something isn't working D-Easy P-Medium S-not-started Work has not started
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants