mvlabat / bevy_egui

This crate provides an Egui integration for the Bevy game engine. 🇺🇦 Please support the Ukrainian army: https://savelife.in.ua/en/
MIT License
958 stars 248 forks source link

How to specify the camera for Egui rendering? #315

Open w4ngzhen opened 1 month ago

w4ngzhen commented 1 month ago

Hello, bevy_egui is a great library! But may I ask, is there any way to specify the camera for Egui rendering? Or, how can I configure the viewport for Egui rendering?

mvlabat commented 1 month ago

Hi! Thank you for the kind words.

Atm, bevy_egui attaches its contexts either to windows or to textures. There are examples on how to render to a texture or to a different window:

Is it something that could work for you?

If not, maybe there's a way we could get context attachable to cameras. But I'd like to hear more about your use-case first :)

I think the only thing that attaching to a camera would bring is limiting Egui to a certain viewport size (which we don't have a clean API for atm), but everything else should be possible already if I'm not missing anything.

w4ngzhen commented 1 month ago

Thank you very much for your reply. After careful consideration, I realized that my thoughts were indeed too complicated. My idea is that if bevy_egui can specify different cameras, then I can spawn a specific camera in certain scenarios and render the content of egui onto that specific camera. Now it seems that this scenario is too complex, perhaps I only need to display a widget at the specified location.