I’m trying to use rigidbody.velocity to move my player, however it doesn’t seem to work at all.
Here is the rigidbody settings on the player:
Here are the input settings:
And here is the file controlling player movement:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerController : MonoBehaviour {
public Rigidbody rb;
void Start () {
rb = GetComponent<Rigidbody>();
}
void Update () {
Vector3 desiredVelocity = Input.GetAxis("Horizontal") * transform.right + Input.GetAxis("Vertical") * transform.forward;
rb.velocity = Vector3.Lerp(rb.velocity, desiredVelocity, Time.deltaTime * 5f);
}
}
Can someone explain to me why this doesn’t work?