So what is the nitty gritty of using Matrix4x4? I need to assign it in Graphics.DrawMeshInstanced but I am unfamiliar with how we assign these. I have all the positions and rotations ready to go.
On the Matrix4x4 page in the Unity Manual you can use the function Matrix4x4.TRS(), which constructs a Matrix applying a translation, rotation and scaling vector value. If you have all of these values, it should be trivial ![]()
Quaternion rotation = Quaternion.Euler(eulerAngles.x, eulerAngles.y, eulerAngles.z); Matrix4x4 m = Matrix4x4.TRS(translation, rotation, scale);
Here’s a link to the Unity scripting API for Matrix4x4.TRS()
Matrix.4x4.SetTRS is just what I needed.