This commit is contained in:
Ignis 2021-08-23 17:34:17 +02:00
commit 8d16a4fd30

View file

@ -47,8 +47,8 @@ public class Dobber : MonoBehaviour
void Move()
{
//new Vector3 for calculating movement values
Vector3 move = new Vector3(0, 0, moveVertical * moveSpeed);
Quaternion rotate = Quaternion.Euler(transform.rotation.x, moveHorizontal * turnSpeed , transform.rotation.z);
Vector3 move = new Vector3(0, rb.velocity.y, moveVertical * moveSpeed);
Quaternion rotate = Quaternion.Euler(transform.rotation.x, moveHorizontal * turnSpeed, transform.rotation.z);
//here we apply the movement related to the rotation of player
rb.velocity = transform.right * move.x + transform.up * move.y + transform.forward * move.z;
gameObject.transform.rotation = transform.rotation * rotate;