Why is my code not working?
using UnityEngine;
using System.Collections;
public class NewBehaviourScript1 : MonoBehaviour
{
public float moveSpeed;
public Vector3 input;
public Rigidbody rb;
void Start ()
{
rb = GetComponent<Rigidbody>();
}
void FixedUpdate ()
{
moveSpeed = 2;
input = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
rb.AddForce(input * moveSpeed);
}
}
moveSpeed = 50
or you can decreaseMass in Rigidbody
.because when you multiply small float * big float = small float e.g 50 * 0.1 = 5 \$\endgroup\$input
andrb
should likely beprivate
variables. \$\endgroup\$