Fixed followMouse bug layover from old origin point problem
This commit is contained in:
parent
c6a21b24bb
commit
6691d670e2
1 changed files with 1 additions and 1 deletions
|
|
@ -130,7 +130,7 @@ void GameActor::cycleWeapons(const MouseState& mouse_state)
|
|||
}
|
||||
void GameActor::followMouse(const MouseState& mouse_state)
|
||||
{
|
||||
glm::vec2 direction = glm::vec2(mouse_state.x, mouse_state.y) - glm::vec2(localPosition.x + 0.5f * scale.x, localPosition.y + 0.5f * scale.y);
|
||||
glm::vec2 direction = glm::vec2(mouse_state.x, mouse_state.y) - glm::vec2(localPosition.x, localPosition.y);
|
||||
float newRotation = glm::degrees(glm::atan(direction.y, direction.x));
|
||||
if (getDirectionFromRotation(rotation) != getDirectionFromRotation(newRotation)) {
|
||||
if (auto event = sceneContext->getEventManager().lock()) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue