-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Clarify Transform
and GlobalTransform
documentation (adopted)
#15358
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks clear and now populated with useful examples of what to do or how to do. All good.
@@ -9,33 +9,62 @@ use bevy_reflect::{std_traits::ReflectDefault, Reflect}; | |||
#[cfg(all(feature = "bevy-support", feature = "serialize"))] | |||
use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; | |||
|
|||
/// [`GlobalTransform`] is an affine transformation from entity-local coordinates to worldspace coordinates. | |||
/// Describes the absolute transform (translation, rotation, scale) of an entity in space, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The (translation, rotation, scale)
part is a bit misleading, since GlobalTransform
is not a TRS transformation in general. This also applies to the later part of this doc comment which breaks down translation, rotation, and scale.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I might see if I can walk that part back a bit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind re-checking, just to see if I've understood you correctly? Cheers!
Co-authored-by: Matty <weatherleymatthew@gmail.com>
Could we remove my tagged username from the description so it doesn't end up in a commit message? |
Removed to prevent endless notification spam for both of you. |
Sorry! |
/// | ||
/// [`Transform`] is the local transform (translation, rotation, scale) of an entity in space. | ||
/// If the entity has a parent, the local transform is relative to its parent's | ||
/// [`GlobalTransform`], otherwise, it's relative to the main reference frame. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// [`GlobalTransform`], otherwise, it's relative to the main reference frame. | |
/// [`GlobalTransform`]; otherwise, it's relative to the main reference frame. |
/// [`Transform`] is the local transform of an entity in space relative to its parent transform, | ||
/// or the global transform relative to the main reference frame if it doesn't have a [`Parent`]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// [`Transform`] is the local transform of an entity in space relative to its parent transform, | |
/// or the global transform relative to the main reference frame if it doesn't have a [`Parent`]. | |
/// [`Transform`] is the local transform of an entity in space relative to its parent transform; | |
/// if it doesn't have a [`Parent`], then it is equivalent to the global transform relative to the main reference frame. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd go with a separate sentence here.
/// - The `scale` is relative to the parent's [`GlobalTransform`], it is multiplied | ||
/// by it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// - The `scale` is relative to the parent's [`GlobalTransform`], it is multiplied | |
/// by it. | |
/// - The `scale` is relative to the parent's [`GlobalTransform`] (it is multiplied in) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hrm, I'm not particularly convinced by either one. Maybe simply,
The
scale
is multiplied by the parent entity's [GlobalTransform
].
?
/// [`Transform`] is the local transform of an entity in space relative to its parent transform, | ||
/// or the global transform relative to the main reference frame if it doesn't have a [`Parent`]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// [`Transform`] is the local transform of an entity in space relative to its parent transform, | |
/// or the global transform relative to the main reference frame if it doesn't have a [`Parent`]. | |
/// [`Transform`] is the local transform of an entity in space relative to its parent transform; | |
/// if it doesn't have a [`Parent`], then it is the global transform relative to the main reference frame. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think I'll add a sentence here too.
/// [`TransformPropagate`]. | ||
/// Those systems run during [`PostUpdate`]. | ||
/// If you update the [`Transform`] of an entity in this schedule or after, | ||
/// you may notice a 1 frame lag before the [`GlobalTransform`] is updated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// you may notice a 1 frame lag before the [`GlobalTransform`] is updated. | |
/// you may notice 1 frame of lag before the [`GlobalTransform`] is updated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should update to use "one" 🤔
Co-authored-by: Benjamin Brienen <benjamin.brienen@outlook.com>
Co-authored-by: Benjamin Brienen <benjamin.brienen@outlook.com>
Co-authored-by: Benjamin Brienen <benjamin.brienen@outlook.com>
Co-authored-by: Benjamin Brienen <benjamin.brienen@outlook.com>
Co-authored-by: Benjamin Brienen <benjamin.brienen@outlook.com>
Co-authored-by: Benjamin Brienen <benjamin.brienen@outlook.com>
Thanks for the review! I've neglected this PR, will try to get back to it today. |
NOTE: this is adopted from
Selene-Amanita
's #9182. I've:rparrett's
suggestionsOriginal PR description follows. Because it's from last year, it'd be great to get fresh eyes on it to see if it inadvertently removes things we'd like to keep. I also have one question about documentation links, below.