Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 Slapworth · Aug 11, 2013 at 03:21 AM · camerasmoothfirst-person-controllercrosshairstutter

Smoother camera in First Person Controller Prefab?

Hello -

I'm having issues with camera smoothness on a prototype for a first-person game. I couldn't find anything among the current answers list; I'm hoping someone can help.

I started my prototype with the hand-written 1st person controller from the youtube videos by quill18creates: http://www.youtube.com/watch?v=W7NQAF0sQw8 Quill's controller had a smooth camera, which let me add a crosshair (projected in 3D space) that was equally smooth. The crosshair remained locked in place no matter how fast I moved the camera.

I decided to switch to Unity's 1st Person Controller prefab, and found that its camera seemed significantly less smooth. Mouselook is uneven, and the crosshair that's projected into 3D space is shaking in place, as it's being positions a frame after the camera updates.

Is there a way to improve the camera for the 1st person controller prefab? Should I do something specific to synchronize my crosshair updates with the update behavior of the controller and camera? Or is this a normal issue with the 1st person controller prefab?

Thanks for your help.

  • Slapworth

UPDATE: I should clarify that the crosshair is projected into 3D space to enable depth-related gameplay feedback; so pushing the crosshair into an OnGUI call is a non-desirable solution.

Comment
Add comment · Show 2
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 cdrandin · Aug 11, 2013 at 04:13 AM 0
Share

Have you happened to using Lerp by any chance? Usually this produces smooth movement.

avatar image Slapworth · Aug 11, 2013 at 03:24 PM 0
Share

I haven't used Lerp in this context. $$anonymous$$y concern with adding interpolation is that it will introduce $$anonymous$$ORE lag into the crosshair.

In the old prototype, the crosshair was perfectly positioned, dead-center, every frame. I'm worried lerping would cause it to swim around (smoothly, granted, but still undesirably) as the camera moves.

At the moment, the most fruitful path would be to force a crosshair update in sync with the FPS controllers update, so that I know that there's one update of each before the next screen draw. Unfortunately, I don't really understand the flow of update, fixedupdate and draw calls in Unity, so I'm not sure what I should be moving where.

Does Lerp still feel helpful in that context? $$anonymous$$aybe I'm missing something.

Thanks - Slapworth

EDIT: Derp. Switching the crosshair's update to LateUpdate() fixed this. Still not sure it's the "proper" solution, but it definitely removed the stuttering from the crosshair.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Slapworth · Aug 11, 2013 at 04:31 PM

::reads about LateUpdate()::

::smacks head::

I'm not sure if this is the only or best way to fix the problem, but pushing the crosshair update to LateUpdate() fixed this for me.

Is there another way to synchronize updates? Could/should I directly call UpdateCrosshair from within the FPS Controller scripts? (There's other gameplay associated with the crosshair's input, which as the prototype expands, may or may not care about where it occurs in the update sequence.

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

14 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

Related Questions

How do I fix Camera stuttering in first person? 1 Answer

Access to the Camera of a First Person Controller 1 Answer

Changing the camera from first person to third person. 1 Answer

Raycast based on crosshair on screen 1 Answer

How you change another script value smoothly on trigger 0 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