Skip to content

Commit

Permalink
fix(AiPlayer): decide to revert to set position and rotation directly (
Browse files Browse the repository at this point in the history
  • Loading branch information
Ethkuil authored May 15, 2023
1 parent 1c2fdc0 commit 91691e0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Assets/Scripts/GameLogic/PlayerPresenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void Move(ForwardOrBackward direction)
// Make the game object move

Vector2 directionVector = Quaternion.Euler(0, 0, model.rotation) * Vector2.up * (direction == ForwardOrBackward.Forward ? 1 : -1);
_rb2D.MovePosition(_rb2D.position + directionVector * PlayerModel.MaxVelocity * Time.fixedDeltaTime);
_rb2D.position += directionVector * PlayerModel.MaxVelocity * Time.fixedDeltaTime;
_rb2D.velocity = Vector2.zero;
_rb2D.angularVelocity = 0;
// Model is updated in FixedUpdate
Expand All @@ -124,7 +124,7 @@ public void Rotate(LeftOrRight direction)

// Make the game object rotate
float angle = PlayerModel.RotationSpeed * Time.fixedDeltaTime * (direction == LeftOrRight.Left ? 1 : -1);
_rb2D.MoveRotation(_rb2D.rotation + angle);
_rb2D.rotation += angle;
_rb2D.velocity = Vector2.zero;
_rb2D.angularVelocity = 0;
// Model is updated in FixedUpdate
Expand Down

0 comments on commit 91691e0

Please sign in to comment.