Quantcast
Channel: Latest Questions by Davoid ZalaX
Viewing all articles
Browse latest Browse all 6

Parsing error called but can't figure it out. please help!

$
0
0
Here is my C# code. The error is called on the final line and if I change it a ton of compiler errors come up! // Converted from UnityScript to C# at http://www.M2H.nl/files/js_to_c.php - by Mike Hergaarden // Do test the code! You usually need to change a few small bits. using UnityEngine; using System.Collections; public class MYCLASSNAME : MonoBehaviour{ float rotataionSpeed = 10; float walkSpeed = 7; float gravity = 50; private float yRot; Transform body; void Update (){ CharacterController Controller = GetComponent(); Vector3 vertical = transform.TransformDirection(Vector3.forward); Vector3 horizontal = transform.TransformDirection(Vector3.right); Vector3 height = transform.TransformDirection(Vector3.up); if(Input.GetKeyDown("space")){ Jump(); } if(Input.GetAxis("Vertical") || Input.GetAxis("Horizontal")){ animation.CrossFade("walk", 0.2f); animation["walk"].speed = walkSpeed/10; Controller.Move((vertical*(walkSpeed*Input.GetAxis("Vertical")))*Time.deltaTime); Controller.Move((horizontal*(walkSpeed*Input.GetAxis("Horizontal")))*Time.deltaTime); }else{ animation.CrossFade("idle", 0.2f); } if(Input.GetAxis("Mouse X")){ yRot += 10*Input.GetAxis("Mouse X"); } transform.rotation = Quaternion.Euler(0, yRot, 0); Controller.Move(height*gravity*Time.deltaTime); } void LateUpdate (){ // Rotate the Character to match the direction he/she is going if(Input.GetAxis("Vertical") == 0){ if(Input.GetAxis("Horizontal") > 0){ body.localEulerAngles.y = 180; }else if(Input.GetAxis("Horizontal") 0){ if(Input.GetAxis("Horizontal") > 0){ body.localEulerAngles.y = 135; }else if(Input.GetAxis("Horizontal") 0){ body.localEulerAngles.y = -135; }else if(Input.GetAxis("Horizontal")

Viewing all articles
Browse latest Browse all 6

Latest Images

Trending Articles





Latest Images