Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add system parameter for computing up-to-date GlobalTransforms #8603

Merged
merged 7 commits into from
Oct 18, 2023

Conversation

tim-blackbird
Copy link
Contributor

Objective

Add a way to easily compute the up-to-date GlobalTransform of an entity.

Solution

Add the TransformHelper(Name pending) system parameter with the compute_global_transform method that takes an Entity and returns a GlobalTransform if successful.

Changelog

  • Added the TransformHelper system parameter for computing the up-to-date GlobalTransform of an entity.

@james7132 james7132 added C-Enhancement A new feature A-Animation Make things move and change over time A-Transform Translations, rotations and scales labels May 14, 2023
@james7132
Copy link
Member

This could be very useful for implementing inverse kinematics for animation systems. Added the A-Animation label.

@james7132 james7132 added this to the 0.12 milestone Jul 5, 2023
/// you use the [`GlobalTransform`] component stored on the entity, unless you need
/// a [`GlobalTransform`] that reflects the changes made to any [`Transform`]s since
/// the last time the transform propagation systems ran.
#[derive(SystemParam)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably mention that this takes read access on Parent and Transform

@hymm hymm self-requested a review September 29, 2023 16:20
Copy link
Contributor

@hymm hymm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

made one minor suggestion. Not blocking.

}
}

fn map_error(err: QueryEntityError, ancestor: bool) -> ComputeGlobalTransformError {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we use a const generic for ancestor?

@hymm hymm added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Oct 4, 2023
}

/// Error returned by [`TransformHelper::compute_global_transform`].
#[derive(Debug)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how important but would be nice to derive Error on all error things :)

@alice-i-cecile
Copy link
Member

@devil-ira CI failures look real: could you fix it up?

@alice-i-cecile alice-i-cecile removed this from the 0.12 milestone Oct 18, 2023
@alice-i-cecile alice-i-cecile added the S-Adopt-Me The original PR author has no intent to complete this work. Pick me up! label Oct 18, 2023
crates/bevy_transform/src/helper.rs Outdated Show resolved Hide resolved
Co-authored-by: Noah <noahshomette@gmail.com>
@alice-i-cecile alice-i-cecile removed the S-Adopt-Me The original PR author has no intent to complete this work. Pick me up! label Oct 18, 2023
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Oct 18, 2023
Merged via the queue into bevyengine:main with commit 4b65a53 Oct 18, 2023
25 checks passed
ameknite pushed a commit to ameknite/bevy that referenced this pull request Nov 6, 2023
…yengine#8603)

# Objective

Add a way to easily compute the up-to-date `GlobalTransform` of an
entity.

## Solution

Add the `TransformHelper`(Name pending) system parameter with the
`compute_global_transform` method that takes an `Entity` and returns a
`GlobalTransform` if successful.

## Changelog
- Added the `TransformHelper` system parameter for computing the
up-to-date `GlobalTransform` of an entity.

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Co-authored-by: Noah <noahshomette@gmail.com>
rdrpenguin04 pushed a commit to rdrpenguin04/bevy that referenced this pull request Jan 9, 2024
…yengine#8603)

# Objective

Add a way to easily compute the up-to-date `GlobalTransform` of an
entity.

## Solution

Add the `TransformHelper`(Name pending) system parameter with the
`compute_global_transform` method that takes an `Entity` and returns a
`GlobalTransform` if successful.

## Changelog
- Added the `TransformHelper` system parameter for computing the
up-to-date `GlobalTransform` of an entity.

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Co-authored-by: Noah <noahshomette@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Animation Make things move and change over time A-Transform Translations, rotations and scales C-Enhancement A new feature S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants