pub struct Transform {
pub translation: [f64; 3],
pub left_rotation: [f64; 4],
pub scale: [f64; 3],
pub right_rotation: [f64; 4],
}Expand description
A display entity’s transformation (Display entity data, Minecraft Wiki):
the rendered model is translation · left_rotation · scale · right_rotation
applied to the unit cube.
Fields§
§translation: [f64; 3][x, y, z] translation, in blocks.
left_rotation: [f64; 4][x, y, z, w] quaternion applied after scale.
scale: [f64; 3][x, y, z] scale.
right_rotation: [f64; 4][x, y, z, w] quaternion applied before scale.
Implementations§
Source§impl Transform
impl Transform
Sourcepub fn faced(&self, facing: Facing) -> Transform
pub fn faced(&self, facing: Facing) -> Transform
This transform turned by facing about the vertical axis through the
mark: the translation rotated, the yaw composed before the left
rotation. The model is Ryaw · T · L · S · R, which is
T(Ryaw·t) · (Ryaw·L) · S · R — so the emitted entity stands at yaw 0
and no client fact about how a display’s own yaw composes with its
transformation is relied on (spec-0082 §3.2).
Sourcepub fn turned(&self, a: f64) -> Transform
pub fn turned(&self, a: f64) -> Transform
This transform turned by a radians about the vertical axis through the
mark (right-handed about +y: +z turns toward +x) — what
Self::faced does for a quarter turn, for any angle. An aimed
assembly’s facings are turns of this kind (spec-0082 §5.7).
Sourcepub fn cells(&self) -> BTreeSet<[i32; 3]>
pub fn cells(&self) -> BTreeSet<[i32; 3]>
The cells this part’s box meets, relative to the mark’s cell: every
cell the transformed unit cube overlaps with positive volume, judged
exactly (a separating-axis test of the oriented box against the cell),
not by the box’s axis-aligned hull — a part laid on a diagonal meets the
cells along it, never the empty corners of its hull. The entity stands
at the mark cell’s centre (x + 0.5, z + 0.5) on its floor (y).
Sourcepub fn meets_box(&self, lo: [f64; 3], hi: [f64; 3]) -> bool
pub fn meets_box(&self, lo: [f64; 3], hi: [f64; 3]) -> bool
Whether this part’s box overlaps the axis-aligned box lo..hi with
positive volume, judged exactly. Coordinates are relative to the mark’s
cell, which spans [0, 1] on every axis; the entity stands at its
centre on its floor, as for Self::cells.