Vector3Unproject function
Unproject a screen-space point back into object space.
Implementation
Vector3 Vector3Unproject(Vector3 source, Matrix4 projection, Matrix4 view) {
final inv = (projection * view)..invert();
final q = inv.transform(Vector4(source.x, source.y, source.z, 1.0));
if (q.w != 0) return Vector3(q.x / q.w, q.y / q.w, q.z / q.w);
return Vector3(q.x, q.y, q.z);
}