Skip to content

Commit 9ef2a95

Browse files
authored
0.18: Add migration guide for automatic Aabb updates (#22429)
Adds migration guide for #18742. I'm not entirely sure it's necessary, but was implied by #21837 (comment).
1 parent 54a342f commit 9ef2a95

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
title: Automatic `Aabb` updates for sprites and meshes
3+
pull_requests: [18742]
4+
---
5+
6+
Bevy automatically creates an `Aabb` component for entities containing a mesh
7+
or sprite - the `Aabb` is then used for visibility and picking.
8+
9+
In 0.17 the `Aabb` [was not updated](https://github.com/bevyengine/bevy/issues/4294)
10+
if the mesh or sprite was modified. This has been fixed in 0.18. If you were working around the issue by manually updating or removing the
11+
`Aabb`, then the workaround is no longer needed.
12+
13+
```rust
14+
// 0.17: Modify the mesh, and remove the `Aabb` so that it's automatically
15+
// recreated from the modified mesh.
16+
mesh.insert_attribute(Mesh::ATTRIBUTE_POSITION, new_positions);
17+
entity.remove::<Aabb>();
18+
19+
// 0.18: The `Aabb` will be automatically updated.
20+
mesh.insert_attribute(Mesh::ATTRIBUTE_POSITION, new_positions);
21+
```
22+
23+
For users who want more control, 0.18 also adds a `NoAutoAabb` component. This
24+
will disable both automatic creation and automatic update of `Aabb` components.
25+
26+
```rust
27+
entity.insert(NoAutoAabb);
28+
```

0 commit comments

Comments
 (0)