Question by
Janemba3 · Aug 05, 2016 at 10:58 AM ·
script error
Assets/Controller/Character Controller.cs(4,33): error CS8025: Parsing error
using UnityEngine; using System.Collections;
public class Character Controller : MonoBehaviour {
public float inputDelay = 0.1f;
public float forwardVe1 = 12;
public float rotateVe1 = 100;
Quaternion targetRotation;
Rigidbody rBody;
float forwardInput, turnInput;
public Quaternion TargetRotation
{
get { return targetRotation; }
}
void Start()
{
targetRotation = transform.rotation;
if (GetComponent<Rigidbody>())
rBody = GetComponent<Rigidbody>();
else
Debug.LogError("The character needs a rigidbody.");
forwardInput = turnInput = 0;
}
void GetInput()
{
forwardInput = Input.GetAxis("Vertical");
turnInput = Input.GetAxis ("Horizontal");
}
void Update()
{
GetInput ();
Turn ();
}
void FixedUpdate()
{
Run ();
}
void Run()
{
if (Mathf.Abs (forwardInput) > inputDelay)
{
//move
rBody.velocity = transform.forward * forwardInput * forwardVe1;
}
else
//zero velocity
rBody.velocity = Vector3.zero;
}
void Turn()
{
if (Mathf.Abs (turnInput) > inputDelay)
{
targetRotation = Quaternion.AngleAxis(rotateVe1 * turnInput * Time.deltaTime, Vector3.up)
}
transform.rotation *= targetRotation;
}
}
bildschirmfoto-2016-08-05-um-125239.png
(95.2 kB)
Comment
Your answer
Follow this Question
Related Questions
A Problem With A Script Of GUI.HorizontalSlider It Do not Move? 0 Answers
I have a problem with this script and an error appeared, does anyone know why? 0 Answers
How to reference this game object to another class 0 Answers
Can someone tell me what is wrong with this script? 1 Answer
in my script component it says the compile error has to be fixed i dont know how to do that 0 Answers