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 olivercaddy · Apr 26, 2013 at 02:49 PM · ainoobdeltatime

Forward movement Slow? Delta.time? Frame Rate?

Hey I honestly dont know what I am doing with script I have just used ones from the web but as soon as I got the AI script for my enemy, my players forward movement became really slow. However when I look in the sky it become how it should. I have read a lot on hear but could really do with some help.

Thanks for your time.

Hears the AI script,

 var Distance;
 var Target : Transform;
 var lookAtDistance = 25.0;
 var attackRange = 15.0;
 var moveSpeed = 5.0;
 var Damping = 6.0;
 
 function Update ()
 {
     Distance = Vector3.Distance(Target.position, transform.position);
     
     if (Distance < lookAtDistance)
     {
         
         lookAt();
     }
     
     
     if (Distance < attackRange)
     {
         
         attack ();
     }
 }
 
 function lookAt ()
 {
     var rotation = Quaternion.LookRotation(Target.position - transform.position);
     transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime * Damping);
 }
 
 function attack ()
 {
     transform.Translate(Vector3.forward * moveSpeed * Time.deltaTime);
 }
Comment
Add comment · Show 6
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 robertbu · Apr 26, 2013 at 02:58 PM 0
Share

How many enemies are being spawned and how complex is the mesh you are using for your enemies? The behavior you describe would happen if there were a bunch of enemies or if the mesh of the enemies was complex. Or if you were using a mobile device with a shader that was not created with mobile in $$anonymous$$d. Your game would speed up when you look up because the enemies would not be rendered. I doubt your performance problems have much or anything to do with this script. To test, disable the script but leave the enemies.

avatar image olivercaddy · Apr 26, 2013 at 03:06 PM 0
Share

I only have one enemy and he is just a cube at the moment. It still seems to happen when the scrip is disabled the thing is it was fine before I added the enemy :/

avatar image robertbu · Apr 26, 2013 at 03:13 PM 0
Share

Delete the enemy as well just to make sure the issue is in no way related to the enemy, but it sounds like there problem is elsewhere.

avatar image olivercaddy · Apr 26, 2013 at 03:19 PM 0
Share

Yeah you are right I just delete the enemy and still had the problem hmmmm I dont know what to do now lol

avatar image olivercaddy · Apr 26, 2013 at 03:23 PM 0
Share

Sorted it i had a flash light in front of my that once I removed that I could move again Thanks for the help man very appreciated

Show more comments

0 Replies

· Add your reply
  • Sort: 

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

13 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

Related Questions

Multiple Cars not working 1 Answer

Controlling AI Movement 0 Answers

Enter Trigger, display Text, then delete object 1 Answer

Digital Clock: Time.time > 60 2 Answers

Simple AI Script help 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