Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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 Nerdrod2 · Aug 26, 2014 at 10:50 PM · errorjava

Error Java script

I have script for walking and jumping This is link for that http://pastebin.com/raw.php?i=1x3r0RBn

I have 4 errors 1. Assets/My assets/Skript/PlayerMovementScript.js(68,1): BCE0044: expecting }, found ''. 2. Assets/My assets/Skript/PlayerMovementScript.js(61,11): BCE0044: expecting (, found 'OnCollisionExit'.

3.Assets/My assets/Skript/PlayerMovementScript.js(55,2): BCE0044: expecting ), found 'grounded'. 4.Assets/My assets/Skript/PlayerMovementScript.js(50,26): BCE0043: Unexpected token: collision.

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 robertbu · Aug 26, 2014 at 10:54 PM

Though the compiler is only listing 4 errors, you have a lot more than 4 errors. I did a quick pass to get your script to compile. You'll have to figure out any logic problems. For future posts, please past your code into your question, select your code and use the 101/010 button to format. Also proper indentation makes the code easier to read, and in this case, would have made your first error jump out at you.

 var acceleration : float = 10;
 var deacceleration : float = 10;
 
 @HideInInspector
 var deaccelerationX : float;
 @HideInInspector
 var deaccelerationZ : float;
 
 var jumpVelocity : float = 400;
 @HideInInspector
 var grounded : boolean = false;
 var maxslope : float = 60;
 var cameraObject : GameObject;
 var maxSpeed : float = 25;
 @HideInInspector
 var movement : Vector2;
 
 function Update()
 {
 
     movement = Vector2( rigidbody.velocity.x, rigidbody.velocity.z);
 
     if ( movement.magnitude > maxSpeed)
     {
         movement = movement.normalized;
         movement *= maxSpeed;
     }
  
     rigidbody.velocity.x = movement.x;
     rigidbody.velocity.z = movement.y;
      
     if (Input.GetAxis("Horizontal") == 0 && Input.GetAxis("Vertical") == 0 && grounded)
     {
         rigidbody.velocity.x = Mathf.SmoothDamp(rigidbody.velocity.x, 0, deaccelerationX, deacceleration);
         rigidbody.velocity.z = Mathf.SmoothDamp(rigidbody.velocity.z, 0, deaccelerationZ, deacceleration);
     }
 
     transform.rotation = Quaternion.Euler(0, cameraObject.GetComponent(MouseLook).currentYRotation, 0);
     rigidbody.AddRelativeForce(Input.GetAxis("Horizontal") * acceleration * Time.deltaTime, 0, Input.GetAxis("Vertical") * acceleration * Time.deltaTime);
     
     if(Input.GetButtonDown("Jump") && grounded)
     {
         rigidbody.AddForce(0, jumpVelocity,0);
     }
 }
 
 function OnCollisionStay(collision : Collision)
  {
      for (var contact : ContactPoint in collision.contacts)
      {
          if(Vector3.Angle(contact.normal, Vector3.up) < maxslope)
              grounded = true;
      }
  }
  
  function OnCollisionExit()
  {
      grounded = false;
  }

 
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.

Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

UnityScript error in transform.Position 2 Answers

Can you help with my errors? All are similar... 1 Answer

Why are these errors messing with me? 2 Answers

Every time I try to open a javascript I get an error saying some confusing things that I will post below. What do they mean, and how do I fix the error? 2 Answers

syntax errors 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