All in the title really, how would I make a character in 3d that can only walk backwards? I can make it move forward and back but I need to just walk back. Here’s my code:
public class PlayerMove : MonoBehaviour
{
public Rigidbody rb;
public Transform _camera;
public float moveSpeed = 6f;
public LayerMask Ground;
void Start()
{
}
void Update()
{
//facing direction
Debug.DrawLine(_camera.position, transform.forward * 2.5f);
//moving
// float x = Input.GetAxisRaw("Horizontal") * moveSpeed;
float y = Input.GetAxisRaw("Vertical") * moveSpeed;
//setting movement
Vector3 move = transform.forward * y; // transform.right * x + .....
rb.velocity = new Vector3(move.x, rb.velocity.y,move.z);
}
}
e