You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
m_impl->m_view->pick(x, y, [&](View::PickingQueryResult const& result) {
auto depth = result.depth;
if (depth <= 0.0)
{
return;
}
auto projection = m_impl->m_camera->getProjectionMatrix();
float width = m_impl->m_view->getViewport().width;
float height = m_impl->m_view->getViewport().height;
math::details::TVec2<float> viewport_wh{ width, height };
auto clip_space_position = math::details::TVec3<float>((result.fragCoords.xy / viewport_wh) * 2.0 - 1.0, result.fragCoords.z);
math::double4 clip_space_coordinate{ clip_space_position.x, clip_space_position.y, clip_space_position.z, 1 };
math::vec4 view_space_position = inverse(projection) * clip_space_coordinate;
math::float3 coord = math::float3(view_space_position.x, view_space_position.y, view_space_position.z) / view_space_position.w;
////
auto model = m_impl->m_camera->getModelMatrix();
auto world_space_position = model * coord;
auto origin = m_impl->m_camera->getPosition();
..... After clicking on the position of the origin, I used point origin as the starting point and point world_space_position as the ending point, I hope the endpoint of the line falls in the red circle, but I don't know why it falls in the green circle
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Beta Was this translation helpful? Give feedback.
All reactions