• 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 /
avatar image
0
Question by Anykey · Jul 27, 2011 at 04:21 PM · errorsyntax-erroruce0001

Limit rotation for a statue puzzle

Hello everyone, I'm trying to make a puzzle level in my game , with buttons that activate the rotation of a statue , here is the code

 var Statue : GameObject;
 
 float MinClamp1 = 0;
 float MaxClamp1 = 90;
 float MinClamp1 = 90;
 float MaxClamp1 = 180;
 float MinClamp1 = 180;
 float MaxClamp1 = 270;
 float MinClamp1 = 270;
 float MaxClamp1 = 360;
 
 function Update () {
 if (Statue.transform.rotation.y > 360){
 Statue.transform.rotation.y = 0;
 }
 
 }
 
 function OnTriggerStay()
 {
   Statue.transform.rotation.y =        Vector3(Mathf.Clamp(Statue.transform.rotation.eulerAngles.y, MinClamp1, MaxClamp1),0,0);
 }

But it doesn't work , I've got a console error message

Assets/MesAssets/MesScripts/TriggerStatueRotation.js(3,6): UCE0001: ';' expected. Insert a semicolon at the end.

Please ! What should I do ? :(

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
1

Answer by Chris D · Jul 27, 2011 at 04:29 PM

  1. properly declare your float variables (you can't use C# syntax in JS)
  2. re-title your question so people know you're trying to solve a specific error, not a logic problem (at least at the moment)

Proper JS declarations would look like:

var MinClamp1 : float = 0f;

or

var MinClamp1 = 0f;    //or ... = 0.0
Comment
Add comment · Show 2 · 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
avatar image Anykey · Jul 27, 2011 at 08:21 PM 0
Share

Thanks for replying

var speed$$anonymous$$ : float = 2; var speedmax : float = 4;

var from = new Vector3(0,0,0); var to = new Vector3(0,90,0);

Statue.transform.position = new Vector3.RotateTowards(from, to, speed$$anonymous$$, speedmax); it still doesn't work though, I've got this error message: Assets/$$anonymous$$esAssets/$$anonymous$$esScripts/TriggerStatueRotation.js(32,41): BCE0017: The best overload for the method 'UnityEngine.Vector3.RotateTowards(UnityEngine.Vector3, UnityEngine.Vector3, float, float)' is not compatible with the argument list '(UnityEngine.Transform, UnityEngine.Transform, float, float)'.

avatar image Chris D · Jul 27, 2011 at 08:31 PM 0
Share

That's a separate problem. You're feeding RotateTowards the wrong types of data. Take a look at the docs and make some changes.

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Having difficulty with semicolons. 2 Answers

Insert semicolon at the end? 2 Answers

CharacterDamage script semi colon error. 1 Answer

Strange Error in JScript when using "delete" 4 Answers

';' expected. Insert a semicolon at the end. already one there? 1 Answer


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