- Home /
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.
Have you happened to using Lerp by any chance? Usually this produces smooth movement.
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.
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.
Your answer
Follow this Question
Related Questions
How do I fix Camera stuttering in first person? 1 Answer
First person camera restriction. 1 Answer
Camera on Body going crazy 1 Answer
Camera Smooth Follow 2 Answers
Top down shooter camera follow cursor 2 Answers