File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,6 @@ class Element
3131 * @param ModelGuiLight $light
3232 * @param TextureList $textures
3333 * @param ModelDisplaySettings $displaySettings
34- * @param Tinterface|null $tinter
3534 * @return Element
3635 * @throws Exception
3736 */
@@ -52,8 +51,20 @@ public static function fromModelData(
5251
5352 $ rotation = $ data ->rotation_rc ?? $ data ->rotation ?? null ;
5453 if ($ rotation ) {
55- $ element ->rotate (new Vector3 (...$ rotation ->origin ), Axis::from ($ rotation ->axis ), $ rotation ->angle / 180 * pi ());
54+ $ origin = new Vector3 (...$ rotation ->origin );
55+ if (isset ($ rotation ->axis ) && isset ($ rotation ->angle )) {
56+ $ element ->rotate ($ origin , Axis::from ($ rotation ->axis ), $ rotation ->angle / 180 * pi ());
57+ } else {
58+ foreach (Axis::cases () as $ axis ) {
59+ if (!isset ($ rotation ->{$ axis ->value })) {
60+ continue ;
61+ }
62+ $ angle = $ rotation ->{strtolower ($ axis ->name )};
63+ $ element ->rotate ($ origin , $ axis , $ angle / 180 * pi ());
64+ }
65+ }
5666 }
67+
5768 $ element ->scale ($ displaySettings ->getScale ());
5869 $ element ->rotate (Vector3::center (), Axis::Y, $ displaySettings ->getRotation ()->y / 180 * pi ());
5970 $ element ->rotate (Vector3::center (), Axis::X, $ displaySettings ->getRotation ()->x / 180 * pi ());
You can’t perform that action at this time.
0 commit comments