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 Michael 16 · May 05, 2011 at 07:40 PM · errorblenderwhats-wrong

Solve Script class error

There is a problem that is new to me. I imported alot from Blender (models and animations) and everything was perfect. Now I imported my new enemy with 5 animations (I'm useing only 3 but its not the problem) and when i try to put the scrips on the enemy I get an error that say this:"Can't add script behaviour R.H.Control. The script file name does not match the name of the class defined in the script!" ("R.H.Control" is the name of the scrips I created for the enemy). Where/What is the problem??? What does it meen??

If the problem is in my script so please check it:

var distance; var target : Transform; var lookAtDistance = 160.0; var attackRange = 140.0; var deadRange = 100.0; var moveSpeed = 10.0; var damping = 4.0; var shootTest = 0; //the var "shootTest" is for the effect of animation. after the enemy shoots, he put his gun away. //it to make shure that he will do it only after he shoot. static var ableFire = false;

function Update ()
{
distance = Vector3.Distance(target.position, transform.position); if(distance < lookAtDistance) {
renderer.material.color = Color.yellow; animation.Play("GoingToShoot"); lookAt ();
}

  if(distance &gt; lookAtDistance) 
  {   
      renderer.material.color = Color.green;
  }   

  if((distance &lt; attackRange)&amp;&amp;(distance &gt; deadRange)) 
  {   
      if (shootTest &gt; 0)
      {
          animation.Play("StopShoot");
          shootTest = 0;
      }
      attack ();   
  }   

  if(distance &lt; deadRange)
  {
      stop ();
      shootTest ++;
      ableFire = true;
  }

}

function lookAt () { var rotation = Quaternion.LookRotation(target.position - transform.position); transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime * damping); }

function attack () {
ableFire = false; renderer.material.color = Color.red;
transform.Translate(Vector3.forward * moveSpeed *Time.deltaTime); animation.Play("R.H.Walk"); }

function stop () { renderer.material.color = Color.black; }

Sorry for poor english...

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
Best Answer

Answer by Uzquiano · May 05, 2011 at 07:45 PM

Take away the dots, just put RHControl

Comment
Add comment · Show 4 · 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 Uzquiano · May 05, 2011 at 07:46 PM 0
Share

btw, if you are coding in JavaScript you should create a javascript script, meaning that the script should end wit ".js"

avatar image Michael 16 · May 05, 2011 at 07:55 PM 0
Share

Thanks mate! It works. (such a stupid thing to solve it... I never thought on that...)

avatar image Uzquiano · May 05, 2011 at 08:32 PM 0
Share

You are welcome. I'm pretty sure that when I will start using Blender this kind of things will happen to me too ;)

avatar image Michael 16 · May 06, 2011 at 10:58 AM 0
Share

Now there is another problem: The enemy "dance", it do the same animation in loops when it should aim on me and it looks like "danceing robot". when it needs to do another animation it just stop do the animation, don't do the animation it needs to do and after that it start "dance" again... After I checked it not should do it in loops, it says its do it one time...

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

No one has followed this question yet.

Related Questions

Why isn't this mesh not appearing properly? 0 Answers

Error Rotation Object when add animation 0 Answers

Blender UV map texture problem? 1 Answer

Fatal error with import from Blender 2 Answers

why isnt my object showing up? 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