Quantcast
Viewing all articles
Browse latest Browse all 99

error CS1061: Type `PlayerPhysics' does not contain a definition for `Move' and no extension method `Move' of type `PlayerPhysics' could be found (are you missing a using directive or an assembly reference?)

What the heck is this? What kind of error asks me a question?(rhetorical) well here is my script. using UnityEngine; using System.Collections; [RequireComponent(typeof(PlayerPhysics))] public class PlayerController : MonoBehaviour { public float speed = 8; public float acceleration = 12; private float currentSpeed; private float targetSpeed; private Vector2 amountToMove; private PlayerPhysics playerPhysics; // Use this for initialization void Start () { playerPhysics = GetComponent(); } // Update is called once per frame void Update () { targetSpeed = Input.GetAxisRaw ("Horizontal") * speed; currentSpeed = IncrementTowards (currentSpeed, targetSpeed, acceleration); amountToMove = new Vector2 (currentSpeed, 0); playerPhysics.Move (amountToMove * Time.deltaTime); //this is the line it says } private float IncrementTowards(float n, float target, float speed) { if (n == target) { return 0; } else { float dir = Mathf.Sign (target - n); n += Time.deltaTime * dir; return (dir == Mathf.Sign (target - n)) ? n : target; } } }

Viewing all articles
Browse latest Browse all 99

Trending Articles