vertxxyz / Vertx.Debugging

Debugging utilities for Unity
MIT License
508 stars 33 forks source link

GetPosition extension method missing #3

Closed MostHated closed 2 years ago

MostHated commented 2 years ago

Hey there, I went to give this a try so I added it to a new 2020.3 project and received an error that the GetPosition() Extension method did not exist within DebugUtilsMesh.cs.

Line 27

            var unscaledMatrix = Matrix4x4.TRS(localToWorld.GetPosition(), localToWorld.rotation, Vector3.one);

I added the following to the file to fix the issue locally. Not sure where GetPosition was supposed to actually come from?

        private static Vector3 GetPosition(this Matrix4x4 matrix4X4)
        {
            float x = matrix4X4.m03;
            float y = matrix4X4.m13;
            float z = matrix4X4.m23;

            if (float.IsNaN(x)) x = 0;
            if (float.IsNaN(y)) y = 0;
            if (float.IsNaN(z)) z = 0;

            return new Vector3(x, y, z);
        }

Thanks, -MH

vertxxyz commented 2 years ago

Thanks, it's a 2022+ api that snuck in. I was in the process of fixing this but got busy doing other things. I've pushed the fix as 1.9.1, it should be live once it propagates.