Skip to content

Commit 437d982

Browse files
authored
Atmosphere as entity migration guide (#23675)
# Objective - Once PR #23651 is merged we need a migration guide for breaking changes to Bevy's atmosphere. - Post the release note changes as a new PR to review grammar/writing separately ## Solution - Write a migration guide detailing the breaking changes - Adhere to a friendly non-technical tone - Explain the new way of scaling the atmosphere with `Transform` ## Out of scope - Explain how to customize the apparent up axis (i.e. horizon's orientation) -> this should follow intuitively but maybe I should add this too? or maybe this belongs in a release note instead?
1 parent a026ab9 commit 437d982

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
title: "`Atmosphere` is now an entity"
3+
pull_requests: [23651]
4+
---
5+
6+
Previously, the `Atmosphere` component was added on the camera. Instead,
7+
spawn an `Atmosphere` as an entity. The nearest atmosphere will be chosen for rendering.
8+
9+
`AtmosphereSettings` still belongs on the camera. It is the component that enables atmosphere rendering for that view.
10+
11+
The `scene_units_to_m` field has been removed from `AtmosphereSettings`. Use `Transform` on the `Atmosphere` entity for scale. It is inversely proportional to the old `scene_units_to_m` factor. For example, to treat one unit as 1 km (as with `scene_units_to_m: 1000.0`), set scale to `0.001`.
12+
13+
```rust
14+
// 0.18
15+
commands.spawn((
16+
Camera3d::default(),
17+
Atmosphere::earth(earth_medium),
18+
AtmosphereSettings {
19+
scene_units_to_m: 1000.0,
20+
..default()
21+
},
22+
));
23+
```
24+
25+
```rust
26+
// 0.19
27+
let earth = Atmosphere::earth(earth_medium);
28+
let scale = 0.001;
29+
commands.spawn((
30+
earth,
31+
Transform::from_scale(Vec3::splat(scale)).with_translation(-Vec3::Y * earth.inner_radius * scale),
32+
));
33+
34+
commands.spawn((
35+
Camera3d::default(),
36+
AtmosphereSettings::default(),
37+
));
38+
```
39+
40+
If you don't need to customize the scale, a default `Transform` component is added that positions the atmosphere such that the horizon lines up with the camera's default Y-up direction.
41+
42+
```rust
43+
commands.spawn(Atmosphere::earth(earth_medium));
44+
```
45+
46+
The `bottom_radius` and `top_radius` fields on the `Atmosphere` component have been renamed to `inner_radius` and `outer_radius` respectively to reflect their new meaning.
47+
48+
See the updated atmosphere example and documentation for details.

0 commit comments

Comments
 (0)