Porting C# Matrix + Vectors to Openfl

I am trying to port some code from C# to OpenFL and am having issues with my Matrix code:

Matrix.CreateTranslation( new Vector3( -_position.X, -_position.Y, 0 )) * Matrix.CreateRotationZ( _rotation ) * Matrix.CreateScale( new Vector3( Zoom, Zoom, 1 )) * Matrix.CreateTranslation( new Vector3( _viewPortWidth * 0.5, _viewPortHeight * 0.5, 0 ));

I have reviewed the built in openfl.geom.Matrix3D but it does not seem to provide the same functionality,so I am wondering if I should use a third party library?

Can anyone also provide advice on what I should use to replace C# Vector 2’s and Vector3’s?

This looks like a 2D matrix, something like:

var matrix = new Matrix ();
matrix.translate (-position.x, -position.y);
matrix.rotate (rotation);
matrix.scale (zoom, zoom);
matrix.translate (viewportWidth * 0.5, viewportHeight * 0.5);

Then again, the matrix.createBox method might be enough:

var matrix = new Matrix ();
matrix.createBox (zoom, zoom, rotation, viewportWidth * 0.5, viewportHeight * 0.5);

This is maybe even simpler than the original :slight_smile: