public void MoveLeft()
{
this.transform.Translate(-3, 0, 0);
this.transform.position = new Vector3(Mathf.Clamp(this.transform.position.x, -7.6f, 7.6f),0,0);
}
public void MoveRight()
{
this.transform.Translate(3, 0, 0);
this.transform.position = new Vector3(Mathf.Clamp(this.transform.position.x, -7.6f, 7.6f),0, 0);
}
이렇게 했는데 자꾸 고양이의 y값이 올라가서 움직인다;
-->y가 0이면 원점이라 원점이었던 자리로 올라가던 것이었다. 그래서 -3.5 정도 내리니 해결 되었다 !!!
'유니티 기초' 카테고리의 다른 글
고양이 구름 (0) | 2023.08.02 |
---|---|
고양이 구름 올라가기 게임 (0) | 2023.08.02 |
고양의 체력을 적용하고 체력이 0이 되었을경우에 GameOver를 화면에 출력해라! (0) | 2023.08.02 |
고양이 화살표 부딪히면 사라짐 (0) | 2023.08.01 |
표창 던지기 (0) | 2023.08.01 |