T_
Size: a a a
T_
б
б
AL
O
AL
O
AL
PK
SE
float horizontal = Input.GetAxisRaw("Horizontal");
float vertical = Input.GetAxisRaw("Vertical");
Vector3 target = transform.position + Vector3.forward * vertical + Vector3.right * horizontal;
Vector3 direction = target - transform.position;
rb.velocity = (Vector3.forward * vertical + Vector3.right * horizontal) * speed;
transform.LookAt(target);
if(direction != Vector3.zero)
{
Quaternion rotation = Quaternion.LookRotation(direction);
transform.rotation = Quaternion.Slerp(transform.rotation, rotation, rotationSpeed * Time.deltaTime);
Debug.Log(transform.rotation);
}
SE
d
G
G
R
PK
PK
JO