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 /
This question was closed Oct 09, 2013 at 11:31 PM by clunk47 for the following reason:

Problem is not reproducible or outdated

avatar image
0
Question by Allrthur · Oct 02, 2012 at 06:59 PM · javascript

Problems with javascript

I followed an outdated tutorial on how to create an AI the tutorial version of the unity is the 3.5.0 and mine is 3.5.6 so here is the tutorial's error line :

 #pragma strict
 var distHeroi : Vector3; 
 var velocidadeTranlate: float; 
 var distanciaMinima: float; 
 var normX: float; 
 var normZ: float;
 
 function Start () 
 { 
     distanciaMinima = 10; 
 }
 
 function Update () 
 {
     velocidadeTranlate = 6 * Time.deltaTime;
     
     distHeroi = corpo.posicaoHeroi - transform.position; 
     normX = distHeroi.x; 
     normZ = distHeroi.z;
     
     if(normX < 0) 
         normX = -normX; 
     
     if(normZ < 0) 
         normZ = -normZ;
     
     print(normX+" - "+normZ);
     
     if(normX == 0)
         transform.Translate(velocidadeTranlate,0,0); 
         
     else 
         transform.Translate(-velocidadeTranlate,0,0);
     
     if(distHeroi.z > 0) 
         transform.Translate(0,0,velocidadeTranlate); 
         
     else 
         transform.Translate(0,0,-velocidadeTranlate); 
 } 
  
 function OnCollisionEnter(collision: Collision) 
 { 
     if (collision.gameObject.tag == "Bala") 
     { 
         Destroy(gameObject);
     }
 }
 


So i created that script:

 #pragma strict
 var helidistance : Vector3; function Start () 
 {
 
 }
 
 function Update () 
 {
     helidistance = Helimovimentação.posicao - transform.position;
 } 
 
 function OnCollisionEnter(collision: Collision)
 { 
     if (collision.gameObject.tag == "Bullet")
     { 
         Destroy (gameObject); 
     } 
 }

And the error message is that one :

Assets/Scripts/Inimigo.js(9,29): BCE0044: unexpected char: 0xE7.

Please help and thanks.

OBS: corpo.posicaoHeroi "corpo" is another script that is the hero's script, wich has a position variable like this :

 var posicao : Vector3

 
Comment
Add comment · Show 3
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 AlucardJay · Oct 02, 2012 at 07:00 PM 1
Share

Please format your code. You can do this by highlighting all your code, then clicking the 10101 button at the top of the edit window.

Though, it may be easier just to delete the code, paste it in again from the source, then highlight all the code and press the 101010 button at the top of the edit window before posting.

avatar image AlucardJay · Oct 02, 2012 at 07:07 PM 1
Share

corpo.posicaoHeroi is not declared or assigned. Is this meant to be hero.position - transform.position; ?

avatar image clunk47 · Aug 09, 2013 at 03:02 AM 0
Share

Well I formatted your scripts as well as fixed a few errors in them. as @alucardj stated, corpo is not defined, and if 'corpo' is your second script, I'm assu$$anonymous$$g you're trying to access posicaoHeroi as a static variable, but it doesn't exist in that script. You also had some weird invalid character: 'ã' in "Helimovimentação.posicao"... These are the problems. $$anonymous$$issing variables and I'm not sure what to say about that Helimovimentação.posicao lol

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

11 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

Related Questions

Blimp (airship) Script 0 Answers

BCE0044 Error - expecting :, found '=' 0 Answers

Can someone help me fix my Javascript for Flickering Light? 6 Answers

Error: not a member of 'UnityEngine.GameObject[]'. 2 Answers

Objectives based on object appear. 2 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