Есть Объект, главный персонаж и когда в rigidbody вкл гравитация, то при перемещении персонажа он подергивается. Видео - https://drive.google.com/open?id=1WfTmejZ3guE2EYkujfpH-pJw936qClLD
Код управления.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
private Rigidbody myBody;
public float moveForce = 10f;
private VariableJoystick joystick;
private PlayerAnimation anim;
// Start is called before the first frame update
void Awake()
{
myBody = GetComponent<Rigidbody>();
joystick = GameObject.FindWithTag("Joystick").GetComponent<VariableJoystick>();
anim = GetComponent<PlayerAnimation>();
}
// Update is called once per frame
void Update()
{
myBody.velocity = new Vector3(joystick.Horizontal * moveForce, myBody.velocity.y, joystick.Vertical * moveForce);
if(joystick.Horizontal != 0f || joystick.Vertical != 0f)
{
anim.Run(true);
transform.rotation = Quaternion.LookRotation(myBody.velocity);
}
else
{
anim.Run(false);
}
}
}