fix: Update show elesplayer,

This commit is contained in:
tung.do@monkey.edu.vn
2025-09-08 01:27:59 +07:00
parent b67ca3d945
commit 3eee335208
9 changed files with 202 additions and 80 deletions
+23 -23
View File
@@ -93,32 +93,32 @@ public class CharacterCtrl : MonoBehaviour
playerVelocity.y = 0f;
}
float x = joystick.Horizontal;
float z = joystick.Vertical;
//float x = joystick.Horizontal;
//float z = joystick.Vertical;
Vector3 move = new Vector3(x, 0, z);
move = Vector3.ClampMagnitude(move, 1f);
//Vector3 move = new Vector3(x, 0, z);
//move = Vector3.ClampMagnitude(move, 1f);
if (move != Vector3.zero)
{
transform.forward = move;
if (isRun)
{
SetAnimRun();
}
else
{
SetAnimWalk();
}
}
else
{
SetAnimIdle();
}
//if (move != Vector3.zero)
//{
// transform.forward = move;
// if (isRun)
// {
// SetAnimRun();
// }
// else
// {
// SetAnimWalk();
// }
//}
//else
//{
// SetAnimIdle();
//}
playerVelocity.y += gravityValue * Time.deltaTime;
Vector3 finalMove = (move * playerSpeed) + (playerVelocity.y * Vector3.up);
controller.Move(finalMove * Time.deltaTime);
//playerVelocity.y += gravityValue * Time.deltaTime;
//Vector3 finalMove = (move * playerSpeed) + (playerVelocity.y * Vector3.up);
//controller.Move(finalMove * Time.deltaTime);
}