bevy/crates/bevy_transform/src
Sigma-dev 3c2830d607
Improved the global transform api to access rotation and scale (#16211)
# Objective

GlobalTransform's current methods make it unintuitive, long and clunky
to access just the rotation or just the scale.

## Solution

Dedicated just_rotation() and scale() methods to access just these
properties.

I'm not sure about the naming, I chose just_rotation() to show that try
to indicate there is a waste since it also computes the other fields.

## Testing

- Did you test these changes? If so, how?
I tried logging the methods with a rotating and scaling cube and the
values were correct.
- Are there any parts that need more testing?
My methods are based on existing bevy/glam methods so should be correct
from the getgo.
- How can other people (reviewers) test your changes? Is there anything
specific they need to know?
Probably the easiest is using the 3d_rotations example, adding scaling
to it and then logging the methods I added

---

## Showcase
```rust
fn log(gt_query: Query<&GlobalTransform>) {
        for global_transform in gt_query().iter() {
                   println!("{} {}", global_transform.just_rotation(), global_transform.scale());
        }
}
```

---------

Co-authored-by: Sigma-dev <antonin.programming@gmail.com>
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
2024-11-04 15:35:16 +00:00
..
components Improved the global transform api to access rotation and scale (#16211) 2024-11-04 15:35:16 +00:00
bundles.rs Migrate visibility to required components (#15474) 2024-09-27 19:06:16 +00:00
commands.rs Allow World::entity family of functions to take multiple entities and get multiple references back (#15614) 2024-10-07 15:21:40 +00:00
helper.rs Remove thiserror from bevy_transform (#15761) 2024-10-09 14:27:30 +00:00
lib.rs Migrate bevy_transform to required components (#14964) 2024-09-27 17:06:48 +00:00
plugins.rs bevy_transform split up to allow feature gate modularity (#13599) 2024-05-31 16:40:36 +00:00
systems.rs Migrate bevy_transform to required components (#14964) 2024-09-27 17:06:48 +00:00
traits.rs Conversions for Isometry3d ⟷ Transform/GlobalTransform (#14478) 2024-07-25 20:23:32 +00:00