Skip to content

Conversation

@mockersf
Copy link
Member

@mockersf mockersf commented Mar 18, 2021

fixes #1599

  • Added doc on Transform and GlobalTransform to describe usage and how GlobalTransform is updated
  • Documented all methods on Transform
  • #[doc(hidden)] most constructors and methods mutating GlobalTransform, documented the other
  • Mentioned z-ordering for Transform in 2d

@cart cart added this to the Bevy 0.5 milestone Mar 18, 2021
@alice-i-cecile alice-i-cecile added the C-Docs An addition or correction to our documentation label Mar 18, 2021
Copy link
Member

@cart cart left a comment

Choose a reason for hiding this comment

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

Thanks for putting this together so quickly!

Self::from_translation(Vec3::new(x, y, z))
}

/// Crate a new identity [`Transform`], with no translation, rotation, and a scale of 1 on
Copy link
Member

Choose a reason for hiding this comment

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

nit: creates

}

/// Crate a new identity [`Transform`], with no translation, rotation, and a scale of 1 on
/// all axis.
Copy link
Member

Choose a reason for hiding this comment

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

nit: axes

}
}

/// Extracts the translation, rotation and scale from `matrix`. It must be a 3d affine
Copy link
Member

Choose a reason for hiding this comment

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

nit: i like the oxford comma ("translation, rotation, and scale")

}

/// Create a new [`Transform`], with `translation`. Rotation will be 0 and scale 1 on
/// all axis.
Copy link
Member

Choose a reason for hiding this comment

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

nit: axes

/// Returns transform with the same translation and scale, but rotation so that
/// transform.forward() points at target
/// Update and return this [`Transform`] by rotating it so that its unit vector in the
/// local x direction is toward `target` and its unit vector in the local y direction
Copy link
Member

Choose a reason for hiding this comment

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

"unit vector in the local x direction is toward target" should be "local z direction"

self
}

/// Returns the 3d affine transformation matrix from this transform translation,
Copy link
Member

Choose a reason for hiding this comment

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

nit: "this transform's translation"

value
}

/// Change the `scale` of this [`Transform`].
Copy link
Member

Choose a reason for hiding this comment

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

We should probably be more clear that this multiplies the current scale by the given scale.

self.scale *= scale;
}

/// Rotate this [`Transform`] so that its unit vector in the local x direction is toward
Copy link
Member

Choose a reason for hiding this comment

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

This should also be "local z direction"

@mockersf
Copy link
Member Author

CI error is probably due to a new rust lint in nightly in bevy_reflect

@cart
Copy link
Member

cart commented Mar 19, 2021

Fixing now.

@cart
Copy link
Member

cart commented Mar 19, 2021

Fixed in #1690. Kind of weird that this appears to be a statically dispatched method (no instance used), but it still requires the dyn annotation (because it is inside a dyn impl block).

@cart
Copy link
Member

cart commented Mar 19, 2021

bors r+

bors bot pushed a commit that referenced this pull request Mar 19, 2021
fixes #1599 

* Added doc on `Transform` and `GlobalTransform` to describe usage and how `GlobalTransform` is updated
* Documented all methods on `Transform`
* `#[doc(hidden)]` most constructors and methods mutating `GlobalTransform`, documented the other
* Mentioned z-ordering for `Transform` in 2d
@bors
Copy link
Contributor

bors bot commented Mar 19, 2021

@bors bors bot changed the title documentation on Transform and GlobalTransform [Merged by Bors] - documentation on Transform and GlobalTransform Mar 19, 2021
@bors bors bot closed this Mar 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-Docs An addition or correction to our documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Better documentation for Transform and GlobalTransform

3 participants