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 Frezno · Jun 07, 2014 at 10:56 PM · fpscontrollerslowstuck

How do I make my FPSController more responsive and smooth (it's very sluggish)?

Hello I have an FPSController script and it plays fine, but it is very sluggish and when it comes into contact with any that has physics/collision like a wall or box it kind of just gets "caught" in the collision rather than smoothly reacting to it. I've tried other FPS Controllers and none have this problem from what I've seen, it gets almost unmoveable when it comes into contact with an exact collision mesh. When it comes into contact with a box collider mesh it either reacts by getting stuck or being very sluggish on impact for a few seconds making the player have to remove himself from the wall before he can go back on his way. I'd like any tips, pointers, or any explanations as to why this is happening.

Here's my FPSController Script (I wanted to paste it but it was very long so I used an external link)

http://pastebin.com/PSSMwUgx

Comment
Add comment · Show 1
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 calmcarrots · Jun 08, 2014 at 04:55 AM 0
Share

Bro, nobody is going to look through 1000 lines of code just to see how to make your script better. To me, it looks as if you downloaded this script. So I recommend looking through all the code, taking out the parts you don't need and then work on optimization yourself. Experiment. It's the best way to learn.

Some tips as to why this maybe happening: 1. Too many smoothing variables / functions 2. Too much math calculations 3. Code is running at improper frames (example, every other frame)

Try it yourself and take out parts. If you don't want to, download another script from the Unity Wiki site or just use the one that comes with Unity. The FPS controller from the sample assets is really nice.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Jeff-Kesselman · Jun 07, 2014 at 10:59 PM

If you a re running in pro then the first thing you should do is run the profiler and see whats really costing you time.

If you don't have that, tuning this will be a lot harder. Some things to look for:

  1. Update code. Update code runs every frame. You should be doing as little work in Update (or fixed Update) as possible. As much s possible you want to b even driven. Same is true for FixedUpdate.

  2. Debug logging. Debug logging is surpassingly expensive. if you a re spitting out a lot of debug log info to the consoe, try commenting it out.

  3. CollisionStay methods. This gets back to begin event driven rather then polling. Try do do as much work as possible on the enter and exit rather then on every stay frame

Comment
Add comment · Show 1 · 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 Frezno · Jun 08, 2014 at 04:46 AM 0
Share

Well I didnt actually mean performance wise, because i am getting near 300 fps on a pretty old card. What I meant was the actually fps controller, but thank you for the extra tips as I may have this problem in the future.

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

23 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Character Controller with Relative Gravity? 1 Answer

Game runs normal on editor, but it's slow on build 1 Answer

Beginning an underwater game 1 Answer

Pushing rigidbody with FPS Controller 3 Answers

Game speed slows down as FPS slows down (on android, only after unity3.4) 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