Answer the question
In order to leave comments, you need to log in
How to make a smooth movement of the character?
The player goes to the front and can move to the right or left.
I wrote this code, but the movement is too sharp. How to fix it?
private Vector3 _velosity;
// В АПДЕЙТЕ
case TouchPhase.Moved:
_velosity += transform.right * Mathf.Clamp(touch.deltaPosition.x, -_sensitivityLimiter, _sensitivityLimiter) * _sensitivity;
break;
//
private void FixedUpdate()
{
Move();
}
private void Move()
{
_rigitbody.velocity = transform.forward * _moveSpeed + _velosity;
_velosity = Vector3.zero;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question