unproject method

V3 unproject(
  1. M projection,
  2. M view
)

Unprojects this screen-space vector back into world space.

projection and view are the camera's projection and view matrices. Internally multiplies and inverts the combined view-projection matrix, then applies a perspective divide.

Implementation

V3 unproject(M projection, M view) {
  final matViewProj = view.mul(projection).invert();
  final qtransformed = RaylibQuaternionFactories.createFactory(x, y, z, 1.0).transform(matViewProj);
  return _v3(
    qtransformed.x/qtransformed.w,
    qtransformed.y/qtransformed.w,
    qtransformed.z/qtransformed.w,
  );
}