Warped GPU Instanced Objects

Hello,

This may be the wrong section, so i apologize if so. Anyways, I am learning about GPU Instancing and finding some good benefits. I am experimenting with it a bit and trying to see if I can place an instanced object in the exact right position, rotation, and scale. I appear to be understanding the position and scale portions, but the rotation part is baffling.

The issue: When i try to rotate the object using new Quaternion(x, y, z, w) or from a public field, it is distorting the object’s scale (like it is stretching it) and it is moving its position dramatically. When i followed the tutorial it used Random.rotation and that appears to rotate them properly without distortion. But getting the exact rotation is not working.

I am sure i am misunderstanding something pretty basic but after searching the forums and manuals, i believe i am not understanding the Matrix4x4 part. Not sure if that is where my issue is, but it is the only thing i am not grasping properly.

Any explanation or help is appreciated.

Here is my code:

    public int instances;

    public Mesh mesh;

    public Material[] mats;

    private List<List<Matrix4x4>> batches = new List<List<Matrix4x4>>();

    public Vector3 pos; public Quaternion rot; public Vector3 scale;

    // Start is called before the first frame update
    void Start()
    {
        int AddMatricies = 0;
        batches.Add(new List<Matrix4x4>());

        for (int i = 0; i < instances; i++)
        {
            if (AddMatricies < 1000 && batches.Count != 0)
            {
                //batches[batches.Count - 1].Add(Matrix4x4.TRS(new Vector3(Random.Range(0, 50), Random.Range(0, 50), Random.Range(0, 50)), Random.rotation, Vector3.one * 50)); //Works great
                batches[batches.Count - 1].Add(Matrix4x4.TRS(new Vector3(-35.5599f, .242317f, -36.99f), rot, Vector3.one * 103)); // Quaternion parameter does not work properly
                AddMatricies += 1;
            }
            else
            {
                batches.Add(new List<Matrix4x4>());
                AddMatricies = 0;

            }
        }
    }

    // Update is called once per frame
    void Update()
    {
        RenderBatches();
    }

    private void RenderBatches()
    {
        foreach (var Batch in batches)
        {
            for (int i = 0; i < mesh.subMeshCount; i++)
            {
                Graphics.DrawMeshInstanced(mesh, i, mats[i], Batch);
            }
        }
    }

How do you set the quaternion values? Only normalized quaternions correspond with rotations, so you can’t just change the x,y,z,w values any way you want.

I’ve tried setting it via values from the Inspector since “rot” is public. I have also tried just using “new Quaternion(value, value, value, value)” and the same thing happens.