fixed camera issue
This commit is contained in:
@@ -1080,7 +1080,7 @@ MonoBehaviour:
|
||||
jumpSpeed: 35
|
||||
runFasterFactor: 1.5
|
||||
groundErrorThreshold: 3
|
||||
wallLineCaseDistance: 1.5
|
||||
wallLineCaseDistance: 1
|
||||
runErrorThreshold: 0.05
|
||||
--- !u!95 &1671840923
|
||||
Animator:
|
||||
|
||||
@@ -6,6 +6,7 @@ public class CameraMovement : MonoBehaviour
|
||||
{
|
||||
[SerializeField] GameObject player;
|
||||
[SerializeField] float offsetY = 0;
|
||||
[SerializeField] float offsetZ = -10;
|
||||
[SerializeField] float interpolate = 0.2f;
|
||||
|
||||
private void Start()
|
||||
@@ -16,5 +17,6 @@ public class CameraMovement : MonoBehaviour
|
||||
private void Update()
|
||||
{
|
||||
transform.position = Vector2.Lerp(transform.position, player.transform.position + new Vector3(0, offsetY, 0), interpolate);
|
||||
transform.position = new Vector3(transform.position.x, transform.position.y, offsetZ);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ public class Player : MonoBehaviour
|
||||
|
||||
private void FlipSprite()
|
||||
{
|
||||
if (Mathf.Abs(rigidBody.velocity.x) > Mathf.Epsilon && (Input.GetKey(KeyCode.RightArrow) || Input.GetKey(KeyCode.LeftArrow)))
|
||||
if (Mathf.Abs(rigidBody.velocity.x) > runErrorThreshold && (Input.GetKey(KeyCode.RightArrow) || Input.GetKey(KeyCode.LeftArrow)))
|
||||
{
|
||||
transform.localScale = new Vector2(Mathf.Sign(rigidBody.velocity.x), 1f);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user