I'm new to learning C#. How can I move an arrow one unit at a time?
Here's the code I'm using now:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ArrowMovement : MonoBehaviour
{
float directX;
float directY;
public float moveSpeed = 5f;
private Rigidbody rb;
private void Start()
{
rb = GetComponent<Rigidbody>();
}
private void FixedUpdate()
{
float h = Input.GetAxis("Horizontal") * 100;
float v = Input.GetAxis("Vertical") * 100;
Vector3 vel = rb.velocity;
vel.x = h;
vel.z = v;
rb.velocity = vel;
}
}
I just know how to do basic move