Commit f67da57b authored by chili's avatar chili
Browse files

prevent +/-PI pitch (camera look at does not like that)

parent cdb56818
......@@ -35,7 +35,7 @@ void Camera::SpawnControlWindow() noexcept
ImGui::SliderFloat( "Y",&pos.y,-80.0f,80.0f,"%.1f" );
ImGui::SliderFloat( "Z",&pos.z,-80.0f,80.0f,"%.1f" );
ImGui::Text( "Orientation" );
ImGui::SliderAngle( "Pitch",&pitch,-90.0f,90.0f );
ImGui::SliderAngle( "Pitch",&pitch,0.995f * -90.0f,0.995f * 90.0f );
ImGui::SliderAngle( "Yaw",&yaw,-180.0f,180.0f );
if( ImGui::Button( "Reset" ) )
{
......@@ -55,7 +55,7 @@ void Camera::Reset() noexcept
void Camera::Rotate( float dx,float dy ) noexcept
{
yaw = wrap_angle( yaw + dx * rotationSpeed );
pitch = std::clamp( pitch + dy * rotationSpeed,-PI / 2.0f,PI / 2.0f );
pitch = std::clamp( pitch + dy * rotationSpeed,0.995f * -PI / 2.0f,0.995f * PI / 2.0f );
}
void Camera::Translate( DirectX::XMFLOAT3 translation ) noexcept
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment