Here is my script:
//User Changable Variables var speed : float = 50; var jumpSpeed : float = 50; var gravity : float = 50; //Non User Variables private var moveDirection : Vector3 = Vector3.zero; //Control the Character function Update () { //This is only used within this function var controller : CharacterController = GetComponent(CharacterController); //Conditionals if(controller.isGrounded){ moveDirection = Vector3(0,0,Input.GetAxis("Vertical")); //Changes from world to local space moveDirection = transform.TransformDirection(moveDirection); moveDirection *= speed; } //Jump Input if(Input.GetButton("jump")){ moveDirection.y = jumpSpeed; } //Apply Gravity moveDirection.y -= gravity *Time.deltaTime; //Move The Controller controller.Move(moveDirection *Time.deltaTime); transform.Rotate(0,Input.GetAxis("Horizontal"),0); }
Line: 17 An instance of type ‘UnityEngine.Transform’ is required to access the non static member ‘TransformDirection’.
Line: 28 An instance of type ‘UnityEngine.Transform’ is required to access the non static member ‘Rotate’.
Please help.