bevy/crates/bevy_gizmos/src
Robert Walter d7cb781977
Switch rotation & translation in grid gizmos (#14656)
# Objective

- Fixes #14655

## Solution

Rotation should happen first as this is more easier to conceptualize in
the mind: We rotate around the coordinate origin `Vec3::ZERO` and then
we just shift the geometry so that its center is exactly on the
specified position

## Testing && Showcase

Code:

```rust
    gizmos.grid(
        Vec3::ONE * 10.0,
        Quat::from_rotation_x(PI / 3. * 2.),
        UVec2::splat(20),
        Vec2::new(2., 2.),
        PURPLE,
    );
    gizmos.sphere(Vec3::ONE * 10.0, Quat::default(), 1.0, PURPLE);
```

Before picture:


![image](https://github.com/user-attachments/assets/7fea2e71-e62b-4763-9f9f-7a1ecd630ada)

After picture:


![image](https://github.com/user-attachments/assets/899dad64-010a-4e4b-86ae-53b85fef0bbc)


## Migration Guide

- Users might have to double check their already existing calls to all
the `grid` methods. It should be more intuitive now though.
2024-08-16 23:40:06 +00:00
..
primitives Use u32 for all resolution/subdivision fields in bevy_gizmos (#13927) 2024-06-19 17:28:10 +00:00
aabb.rs Migrate from LegacyColor to bevy_color::Color (#12163) 2024-02-29 19:35:12 +00:00
arcs.rs Use u32 for all resolution/subdivision fields in bevy_gizmos (#13927) 2024-06-19 17:28:10 +00:00
arrows.rs Add axes_2d gizmo. (#12334) 2024-06-04 00:02:38 +00:00
circles.rs Fix gizmos regression (#14633) 2024-08-06 14:00:32 +00:00
config.rs Making bevy_render an optional dependency for bevy_gizmos (#14448) 2024-08-06 13:09:10 +00:00
cross.rs Add cross gizmos (#13883) 2024-06-17 15:45:32 +00:00
gizmos.rs Rename Rotation2d to Rot2 (#13694) 2024-06-05 21:51:13 +00:00
grid.rs Switch rotation & translation in grid gizmos (#14656) 2024-08-16 23:40:06 +00:00
lib.rs Fix 3D Gizmo webgpu rendering (#14653) 2024-08-09 02:55:56 +00:00
light.rs Make gizmos take primitives by ref (#13534) 2024-05-27 13:48:47 +00:00
line_joints.wgsl Normalise matrix naming (#13489) 2024-06-03 16:56:53 +00:00
lines.wgsl view.inverse_clip_from_world should be world_from_clip (#13756) 2024-06-09 14:40:14 +00:00
pipeline_2d.rs Add 2d opaque phase with depth buffer (#13069) 2024-08-07 00:22:09 +00:00
pipeline_3d.rs Move Msaa to component (#14273) 2024-07-22 18:28:23 +00:00
rounded_box.rs Use u32 for all resolution/subdivision fields in bevy_gizmos (#13927) 2024-06-19 17:28:10 +00:00