fix: add cursor pos easing
This commit is contained in:
@@ -132,14 +132,16 @@ void setIsometricView(bool isometric){
|
||||
}
|
||||
|
||||
glm::vec2 getCursorWorldPos(const glm::vec2& cursorPos, float aspectRatio, float zoom, float windowWidth, float windowHeight){
|
||||
float isometricEased = utils::easeInOutExpo(isometricShade);
|
||||
|
||||
float relativeX = (cursorPos.x / windowWidth * 2) - 1;
|
||||
float relativeY = (cursorPos.y / windowHeight * 2) - 1;
|
||||
|
||||
float deltaX = relativeX * aspectRatio / zoom;
|
||||
float deltaY = relativeY / zoom;
|
||||
|
||||
float worldX = camPos.x + deltaX * (1 - isometricView) + (0.5 * deltaX + deltaY) * isometricView;
|
||||
float worldY = camPos.y + deltaY * (1 - isometricView) + (-0.5 * deltaX + deltaY) * isometricView;
|
||||
float worldX = camPos.x + deltaX * (1 - isometricEased) + (0.5 * deltaX + deltaY) * isometricEased;
|
||||
float worldY = camPos.y + deltaY * (1 - isometricEased) + (-0.5 * deltaX + deltaY) * isometricEased;
|
||||
|
||||
return {worldX, worldY};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user