Hello i wrote this script to have my character walking around and allow it to use my animator for that character. It works great except the character moves quite slow anyone get any tips or pointers for me thanks for your time.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class playermovement : MonoBehaviour {
Rigidbody2D rbody;
Animator anim;
void Start ()
{
rbody = GetComponent<Rigidbody2D> ();
anim = GetComponent<Animator> ();
}
void Update ()
{
Vector2 movement_vector = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));
if (movement_vector != Vector2.zero)
{
anim.SetBool("iswalking", true);
anim.SetFloat("inputx", movement_vector.x);
anim.SetFloat("inputy", movement_vector.y);
}
else
{
anim.SetBool("iswalking", false);
}
rbody.MovePosition(rbody.position + movement_vector * Time.deltaTime);
}
}