So i’m looking for the functions similar to those on the Transform class on an object that I can easily set and get in my own scripts. I think the API of the Transform class is really clear and easy to understand as opposed to the Mat4x4 which seems more linked to the mathematical terms.
I would rather not wrap up the Mat4x4 class that acts similar to the Transform class, like so:
namespace Math {
public struct MatTransform {
public Matrix4x4 mat;
Vector2 right { get { return this.mat * Vector3.right; } }
Vector2 left { get { return this.mat * Vector3.left; } }
Vector2 up { get { return this.mat * Vector3.up; } }
Vector2 down { get { return this.mat * Vector3.down; } }
Vector2 TransformPoint(Vector2 vec)
{
return (Vector2)mat.MultiplyPoint3x4((Vector3)vec);
}
Vector2 TransformDirection(Vector2 vec)
{
return (Vector2)mat.MultiplyVector((Vector3)vec);
}
}
}
And the rest of its methods.
In short, I don’t want to instantiate a gameObject and access its transform. But I want to store a local transformation space within my script and access/change it with the functions as are on the Transform class.
I would be using it for an extensive set of objects. It wouldn't directly be an optimization but more an 'ease-of-use' in the long run. ;) Thanks for the tips though, I'll definitely have to double check what is the best road to take down the line.
– BigRoyNo prob! Please mark answer as accepted.
– MakeCodeNowWill do. Even though I still hope it would've been easier. ;)
– BigRoy