2D objects not displaying
Bevy's 2D coordinate space is set up so that your background can be at Z=0.0, and other 2D objects can be layered at positive +Z coordinates above that.
Therefore, to see your scene, the camera needs to be placed far away, at a large +Z coordinate, looking towards -Z.
If you are overriding the camera transform / creating your
own transform, you need to do this! The default transform (with Z=0.0)
will place the camera so that your sprites (at positive +Z coordinates)
would be behind the camera, and you wouldn't see them! You need to
either set a large Z coordinate, or preserve/copy the Z value from the
Transform
that is generated by Bevy's builtin Bundle
constructor (Camera2dBundle::default()
).
By default, when you create a 2D camera using Bevy's built-in Bundle
constructor, Bevy sets the camera Transform
to have Z=999.9. This is close to
the default clipping plane (visible range of Z axis), which is set to 1000.0.