Skip to content

Instantly share code, notes, and snippets.

@MulverineX
Created February 20, 2025 23:23
Show Gist options
  • Save MulverineX/f473dbfd7cc8dadb326074fef05ad76a to your computer and use it in GitHub Desktop.
Save MulverineX/f473dbfd7cc8dadb326074fef05ad76a to your computer and use it in GitHub Desktop.
Minecraft Display Entity Transformation

Minecraft Display Entity Transformation applied to model (after normal entity orientation). Defaults to identity. Interpolated. For an easy GUI, check out Misode's tool.

The value is stored in decomposed object form for interpolation & ease-of-use, Supports storing a non-canonical matrix form describing a row-major matrix, is automatically decomposed by the game with a performance cost.

The matrix takes the following form:

[ 
  s0, s1, s2, tx,
  s3, s4, s5, ty,
  s6, s7, s8, tz,
    i0, i1, i2, w
]

Where:

  • i0-i2: Ignored values, these can be anything, but the game will ignore the values.
  • w: This value is used as a divisor of all other values (except i0-i2). i.e. all the other values get divided by w before doing any further calculations.
  • tx, ty, tz: Translation value, this is used directly as the transformation.translation after dividing by w. i.e. transformation:{translation:[tx/w, ty/w, tz/w]}.
  • s0-s8: After dividing each element by w, this top left 3x3 of the matrix is passed through the Singular Value Decomposition algorithm to extract the transformation.left_rotation, transformation.scale, and transformation.right_rotation. The exact values of this decomposition are difficult to predict.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment