#Unity.Mathematics equivalent of Matrix4x4.MultiplyPoint?

1 messages · Page 1 of 1 (latest)

neat briar
#

Threre's math.transform which behaves like Matrix4x4.MultiplyPoint3x4, is there a builtin method that works the same as Matrix4x4.MultiplyPoint?

quasi needle
#

There is no equivalent, but it is easy to make one:

float3 point;
float4 transformedPoint = math.mul(mat, new float4(point, 1));
transformedPoint /= transformedPoint.w;
odd forge
#

Actually there is, but it's the exact same code already posted. See TransformHelpers.TransformPoint(float4x4, float3)

odd forge
#

...actually, looking more closely, it's not the exact same code; the code in TransformHelpers doesn't include the final divide-by-W. That's not necessary for affine transformations, but should perhaps be included for full generality.

quasi needle
#

I think this is the difference between MultiplyPoint3x4 and MultiplyPoint