// Distance to Plane(Point?)? WTF IS THIS!? func d2p(tmat mathgl.Mat4, point, ray mathgl.Vec3) float32 { var mat mathgl.Mat4 mat.Assign(&tmat) var sub mathgl.Vec3 sub.X = mat[12] sub.Y = mat[13] sub.Z = mat[14] mat[12], mat[13], mat[14] = 0, 0, 0 point.Subtract(&sub) point.Scale(-1) ray.Normalize() dist := point.Dot(mat.GetForwardVec3()) var forward mathgl.Vec3 forward.Assign(mat.GetForwardVec3()) cos := float64(forward.Dot(&ray)) return dist / float32(cos) }