• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by Loxyx666 · May 29, 2016 at 12:49 PM · unity 53derror messagesymbolcs1525

Urgent Help Error cs1525!

Hi, I am getting a Assets/PlayerController.cs(94,19): error CS1525: Unexpected symbol `RotateCamera' error message can somebody pleas tell me how to fix this.

using UnityEngine;

[RequireComponent(typeof(Animator))] [RequireComponent(typeof(ConfigurableJoint))] [RequireComponent(typeof(PlayerMotor))] public class PlayerController : MonoBehaviour {

 [SerializeField]
 private float speed = 5f;
 [SerializeField]
 private float lookSensitivity = 3f;

 [SerializeField]
 private float thrusterForce = 1000f;

 [SerializeField]
 private float thrusterFuelBurnSpeed = 1f;
 [SerializeField]
 private float thrusterFuelRegenSpeed = 0.3f;
 private float thrusterFuelAmount = 1f;

 public float GetThrusterFuelAmount ()
 {
     return thrusterFuelAmount;
 }

 [SerializeField]
 private LayerMask environmentMask;

 [Header("Spring settings:")]
 [SerializeField]
 private float jointSpring = 20f;
 [SerializeField]
 private float jointMaxForce = 40f;

 // Component caching
 private PlayerMotor motor;
 private ConfigurableJoint joint;
 private Animator animator;

 void Start ()
 {
     motor = GetComponent<PlayerMotor>();
     joint = GetComponent<ConfigurableJoint>();
     animator = GetComponent<Animator>();

     SetJointSettings(jointSpring);
 }

 void Update ()
 {
     //Setting target position for spring
     //This makes the physics act right when it comes to
     //applying gravity when flying over objects
     RaycastHit _hit;
     if (Physics.Raycast (transform.position, Vector3.down, out _hit, 100f, environmentMask))
     {
         joint.targetPosition = new Vector3(0f, -_hit.point.y, 0f);
     } else
     {
         joint.targetPosition = new Vector3(0f, 0f, 0f);
     }

     //Calculate movement velocity as a 3D vector
     float _xMov = Input.GetAxis("Horizontal");
     float _zMov = Input.GetAxis("Vertical");

     Vector3 _movHorizontal = transform.right * _xMov;
     Vector3 _movVertical = transform.forward * _zMov;

     // Final movement vector
     Vector3 _velocity = (_movHorizontal + _movVertical) * speed;

     // Animate movement
     animator.SetFloat("ForwardVelocity", _zMov);

     //Apply movement
     motor.Move(_velocity);

     //Calculate rotation as a 3D vector (turning around)
     float _yRot = Input.GetAxisRaw("Mouse X");

     Vector3 _rotation = new Vector3(0f, _yRot, 0f) * lookSensitivity;

     //Apply rotation
     motor.Rotate(_rotation);

     //Calculate camera rotation as a 3D vector (turning around)
     float _xRot = Input.GetAxisRaw("Mouse Y");

     Vector3 _cameraRotation = new float(0f, _xRot, 0f) * lookSensitivity

     //Apply camera rotation
     motor.RotateCamera(_cameraRotation);

     // Calculate the thrusterforce based on player input
     Vector3 _thrusterForce = Vector3.zero;
     if (Input.GetButton ("Jump") && thrusterFuelAmount > 0f)
     {
         thrusterFuelAmount -= thrusterFuelBurnSpeed * Time.deltaTime;

         if (thrusterFuelAmount >= 0.01f)
         {
             _thrusterForce = Vector3.up * thrusterForce;
             SetJointSettings(0f);
         }
     } else
     {
         thrusterFuelAmount += thrusterFuelRegenSpeed * Time.deltaTime;
         SetJointSettings(jointSpring);
     }

     thrusterFuelAmount = Mathf.Clamp(thrusterFuelAmount, 0f, 1f);

     // Apply the thruster force
     motor.ApplyThruster(_thrusterForce);

 }

 private void SetJointSettings (float _jointSpring)
 {
     joint.yDrive = new JointDrive {
         positionSpring = _jointSpring,
         maximumForce = jointMaxForce
     };
 }

}

Thanks!

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by JedBeryll · May 29, 2016 at 01:18 PM

Vector3 _cameraRotation = new float(0f, _xRot, 0f) * lookSensitivity

this line does not have a semicolon at the end.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

89 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

I Need Help With An Error Message!? 1 Answer

Error CS1525 Unexpected Symbol "if" Pls help 1 Answer

How to change main character model via script? 1 Answer

How can I make a game similar to Lego Universe (sort of like a replica) 0 Answers

Animation on raycast enter trigger ? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges