followed and check all my code about 20 times and still can not find the problem, I have my Main camera under my player Capsule
with this code attached to the capsule
var walkacceleration : float = 5;
var cameraObject : GameObject;
var maxwalkspeed : float = 20;
@HideInInspector
var horizontalmovement : Vector2;
function Update ()
{
horizontalmovement = Vector2(rigidbody.velocity.x, rigidbody.velocity.z);
if (horizontalmovement.magnitude > maxwalkspeed)
{
horizontalMovement = horizontalmovement.normalized;
horizontalmovement *= maxwalkspeed;
}
rigidbody.velocity.x = horizontalMovement.x;
rigidbody.velocity.z = horizontalMovement.y;
transform.rotation = Quaternion.Euler(0, cameraObject.GetComponent(MouseLookScript).currentYrotation, 0);
rigidbody.AddRelativeForce(Input.GetAxis("Horizontal") * walkacceleration, 0, Input.GetAxis("Vertical") * walkacceleration);
}
These are the exact same as a person’s tutorials and I still have no idea what is wrong, the player barely moves