Skip to content

Commit

Permalink
fix: ship rotation bug
Browse files Browse the repository at this point in the history
  • Loading branch information
gamecem committed Aug 11, 2023
1 parent 754604c commit 15f28f0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
7 changes: 3 additions & 4 deletions Assets/GameAssets/Scripts/Player/PlayerController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ private void Start()
LimitFallSpeed();
HandleGameModeBehaviour();
}

private void HandleMovement()
{
Observable.EveryFixedUpdate()
Expand Down Expand Up @@ -66,7 +65,7 @@ private void Cube()

private void Ship()
{
transform.rotation = Quaternion.Euler(0, 0, rb.velocity.y * 2);
playerSprite.rotation = Quaternion.Euler(0, 0, rb.velocity.y * 2);

if (Input.GetMouseButton(0))
rb.gravityScale = -4.314969f;
Expand Down Expand Up @@ -94,9 +93,9 @@ private void LimitFallSpeed()
{
Observable.EveryFixedUpdate().Subscribe(_ =>
{
if (rb.velocity.y < -24f)
if ((rb.velocity.y * _gravity) < -24.2f)
{
rb.velocity = new Vector2(rb.velocity.x, -24f);
rb.velocity = new Vector2(rb.velocity.x, -24.2f * _gravity);
}
}).AddTo(gameObject);
}
Expand Down
6 changes: 3 additions & 3 deletions Assets/Scenes/SampleScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!114 &554433969
MonoBehaviour:
m_ObjectHideFlags: 0
Expand All @@ -505,7 +505,7 @@ MonoBehaviour:
gameMode: 1
speed: 2
gravity: 1
state: 2
state: 1
--- !u!58 &554433970
CircleCollider2D:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -601,7 +601,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 554433968}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 12.27, y: 4.66, z: 0}
m_LocalPosition: {x: 17.19, y: -4.52, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
Expand Down

0 comments on commit 15f28f0

Please sign in to comment.