Looking for opinions on bonus objective

After watching the video I noticed how I approached to the bonus objective was different than how Ben wrote it. So I was wondering what potential issues could arise (if any) with my code, as compare to the Ben’s. Instead of using subtracting the two transforms, I used Unity’s static Vector3.distance() method which I know is a extra call, but is it comparable to using a abstract var type? I also do not call Move() if the vector distance is less than the threshold, which in my testing doesn’t have any noticable difference, but could there be any later on?

[UPDATE] Finally was able to produce the bug seen in the video (jittery animation/movement when reaching destination), and fix it by setting move() to Vector3.zero() in a else statment. Though I hope someone could help me determine if I should be using a generic variable to store the subtracted vectors, or the static distance method provided by Unity.

Here is my code for reference:

[code][RequireComponent(typeof (ThirdPersonCharacter))]
public class PlayerMovement : MonoBehaviour
{
[SerializeField] float clickThreshold = .4f;
ThirdPersonCharacter m_Character; // A reference to the ThirdPersonCharacter on the object
CameraRaycaster cameraRaycaster;
Vector3 currentClickTarget;

private void Start()
{
    cameraRaycaster = Camera.main.GetComponent<CameraRaycaster>();
    m_Character = GetComponent<ThirdPersonCharacter>();
    currentClickTarget = transform.position;
}

// Fixed update is called in sync with physics
private void FixedUpdate()
{
    if (Input.GetMouseButton(0))
    {
        switch (cameraRaycaster.layerHit) {
            case Layer.Walkable:
                currentClickTarget = cameraRaycaster.hit.point; // set new target on walkable
                break;
            case Layer.Enemy:
                //Enemy hit
                break;
            default:
                //ignore for now
                break;
        }
    }
    if (Vector3.Distance(currentClickTarget, transform.position) >= clickThreshold) {
        m_Character.Move(currentClickTarget - transform.position, false, false);
    }
}

}
[/code]

Privacy & Terms