#Outline/indicate camera & light positions

9 messages · Page 1 of 1 (latest)

sly radish
#

I suspect this is a FAQ, but I'm having a little trouble searching for it. In a 3D environment, how does one go about showing a visual indicator for the current Camera and PointLight translations? I guess this is similar to what Avian does with its debug rendering, but I don't need much in the way of complexity!

Aaaaand... rubberduck it's gizmos. https://github.com/bevyengine/bevy/blob/main/examples/gizmos/3d_gizmos.rs

Oh well, nice talkin' to ya, https://discord.com/channels/691052431525675048/1019697973933899910! I'll post a simple implementation below when I have one.

sly radish
#

Basically just:

// Show us exactly where the point light is
fn debug_point_light(mut gizmos: Gizmos, light: Query<&Transform, With<PointLight>>) {
    if let Ok(t) = light.get_single() {
        gizmos.sphere(t.translation, Quat::IDENTITY, 0.5, GOLD);
    }
}
#

(I belatedly realised asking to mark the camera position in this particular case was... not smart 😆 )

royal quail
#

Thanks its a question I never thought to ask but I like knowing the answer to

rustic basalt
#

For PointLights there is a component that you add to the entity and it shows for you

#

For other things the position should be based on the GlobalTransform, in case you have a hierarchy each with their own translation

sly radish
rustic basalt