Programatically calculate child offset in world space

Hi All,
Apologies if this has been answered elsewhere, with the terminology I know I can’t find the answer.

I have an Offset in Position / Rotation relative to a Point. Call the Offset O and the Point A;
I have O as a Matrix4x4 but I can get Vector3/Quaternions from that.

Point A could be anywhere, and be rotated.

I want to get the world space of O, offset from Point A.

I can solve this a hacky way… I spawn a Child GameObject under Point A, and set it’s localTransform to the Offset O. I then take the world Position of that new Child.

Q: How can I do this in code?
(I assume my way is horribly inefficient, and that a method using Vector maths would be the better solution)

Seems like you want to get the world space transformation from the offset point relative to transform A.

Transform local to world position:

Vector3 offsetWorldPosition = pointA.TransformPoint(offsetLocalPosition);

Transform local to world rotation:

Quaternion offsetWorldRotation = pointA.rotation * offsetLocalRotation;

Calculate localToWorldMatrix:

Matrix4x4 offsetOfromA_localToWorldMatrix = pointA.localToWorldMatrix * offsetOMatrix;
Vector3 offsetWorldPosition = offsetOfromA_localToWorldMatrix * Vector3.zero;