Third person movement with animations

Hi there,

I’m currently make a third person multiplayer game in unity, and i’m kind of struggling to get nice third person movement
and i have tried everything but just didn’t fell right, or work right. So if anyone could maybe help me with some idea’s of what i could do or check out. And also this doesn’t really feel right for me only because i’m also trying to and in some animations.

And also i have tried this piece of code but can’t seem to get it working because it gives me a error saying, Vector2 does not contain a definition for ‘GetKey’.

Here is the code:

using UnityEngine;
using System.Collections;

public class PlayerController : MonoBehaviour {

public float walkSpeed = 2;
public float runSpeed = 6;

Animator animator;

void Start() {
animator = GetComponent();
}

void Update() {

Vector2 input = new Vector2(Input.GetAxisRaw(“Horizontal”), Input.GetAxisRaw( “Vertical”));
Vector2 inputDir = input.normalized;

if(inputDir != Vector2.zero){
transform.eulerAngles = Vector3.up * Mathf.Atan2(inputDir.x, inputDir.y) * Mathf.Rad2Deg;
}

bool running = input.GetKey(KeyCode.LeftShift);
float speed = ((running) ? runSpeed : walkSpeed) * *inputDir.magnitude;

transform.Translate(transform.forward * speed * Time.deltaTime, Space.World);

float animationSpeedPercent = ((running) ? 1 : .5) * inputDir.magnitude;
animator.SetFloat(“SpeedPercent”, animationSpeedPercent);
}
}

You haven’t provided any details about what’s wrong with your controller. You’ve just said it doesn’t “feel right, or work right”. If you want help with your actual code, you’ll need to tease apart the issues, and try to address them one at a time, and be specific about the problems.

Unless there’s some reason you really want to invest a lot of time building and maintaining your controller, I’d recommend you just use what Unity provides for free. You can customize it from there if you want. But I suspect there’s some stuff in this thread that could help you:

Okay, thank you dgoyette, i will try and take your advise :slight_smile: