Fix collision radius size when zooming

This commit is contained in:
Jan Mrna
2025-10-12 16:19:38 +02:00
parent 1ce793c6e8
commit df6d323e42
2 changed files with 16 additions and 3 deletions

View File

@@ -15,6 +15,18 @@ public:
WorldPos WindowToWorld(WindowPos) const;
WindowSize WorldToWindowSize(WorldSize) const;
WorldSize WindowToWorldSize(WindowSize) const;
template <typename T>
requires std::floating_point<T>
T WindowToWorldSize(T window_size) const {
return window_size / static_cast<T>(m_Zoom);
}
template <typename T>
requires std::floating_point<T>
T WorldToWindowSize(T world_size) const {
return world_size * static_cast<T>(m_Zoom);
}
private:
// TODO this should be replaced with a matrix