- Home /
Assets/Scripts/MovementScript.cs(19,66): error CS1525: Unexpected symbol `.', expecting `)', `,', `;', `[', or `='. But the symbol it's supposed to be
Here is the statement I am having a problem with:
Vector3 absoluteRotation = new Vector3 (transform.eulerAngles.x * (Mathf.Cos ((rigidbody.rotation.eulerAngles.z)/57.2957795f))),
transform.eulerAngles.y * (Mathf.Cos ((rigidbody.rotation.eulerAngles.z)/57.2957795f))),
360 * (Mathf.Sin ((rigidbody.rotation.eulerAngles.z)/57.2957795f)));
The problem is with the transform.eulerAngles.y
Here is my entire code, in case it helps:
using UnityEngine;
using System.Collections;
public class MovementScript : MonoBehaviour {
public float speed = 0, rotationSpeed, speedMultiplier, speedMultiplier2;
float speedValue = 0;
float speedX = 0, speedY = 0, speedZ = 0;
public GUIText ws, ad;
// Update is called once per frame
void FixedUpdate () {
float vertRotation = Input.GetAxis("Vertical");
float sideRotation = Input.GetAxis ("Horizontal");
Vector3 rotation = new Vector3 (vertRotation, sideRotation, 0);
rigidbody.angularVelocity = rotation;
Vector3 absoluteRotation = new Vector3 (transform.eulerAngles.x * (Mathf.Cos ((rigidbody.rotation.eulerAngles.z)/57.2957795f))),
transform.eulerAngles.x * (Mathf.Cos ((rigidbody.rotation.eulerAngles.z)/57.2957795f))),
360 * (Mathf.Sin ((rigidbody.rotation.eulerAngles.z)/57.2957795f)));
transform.eulerAngles = absoluteRotation;
getPgValue ();
ws.text = rigidbody.rotation.eulerAngles.y.ToString();
speedY = (Mathf.Sin ((rigidbody.rotation.eulerAngles.x)/57.2957795f)) * speedMultiplier;
float cosine = Mathf.Cos ((rigidbody.rotation.eulerAngles.x) / 57.2957795f);
speedZ = (Mathf.Cos ((rigidbody.rotation.eulerAngles.y)/57.2957795f)) * cosine * speedMultiplier;
speedX = (Mathf.Sin ((rigidbody.rotation.eulerAngles.y)/57.2957795f)) * cosine * speedMultiplier;
ad.text = "x: " + speedX + "\ny:" + speedY + "\nz: " + speedZ;
rigidbody.velocity = new Vector3 (speedX, -speedY, speedZ);
}
void getPgValue(){
bool pageUp = Input.GetKeyDown (KeyCode.PageUp);
bool pageDn = Input.GetKeyDown (KeyCode.PageDown);
float nextRead = 0.0f;
float waitTime = 0.4f;
if (pageUp && Time.time >= nextRead) {
speedValue = speedValue + 1;
speed = (Mathf.Clamp(speedValue * speedMultiplier, 0, 8*speedMultiplier));
nextRead += waitTime;
}else if (pageDn && Time.time >= nextRead) {
speedValue = speedValue - 1;
speed = (Mathf.Clamp(speedValue * speedMultiplier, 0, 8*speedMultiplier));
nextRead += waitTime;
}
Mathf.Clamp (speedValue, 0, 8 * speedMultiplier);
}
}
It's probably something obvious, but I can't seem to find it.
Comment
Best Answer
Answer by Baste · Nov 10, 2014 at 07:08 PM
You've got two too many right parentheses. If you open the file in Monodevelop or whatever other editor you're using, putting the cursor on a right parenthesis will show you the left one it matches with.
I thought I checked that, but I guess I didn't. I knew it would be obvious. Thanks!