Forum rules - please read before posting.

Camera jitter when using AC & UFPS (solved)

edited September 2014 in Technical Q&A
Hi there!

I’ve been messing around with Adventure Creator and Ultimate FPS for a while now, but no matter what I try, I don’t seem to get the two working together properly. Before updating AC to v1.3.8b, I had a lot of issues when using both assets together (jumping, crouching and the footstep manager were only working on Unity terrain, not on custon meshes, ladders were infinately climable, footstep manager not working and AI bullets were able to shoot at the player through walls). All these issues seemed to be fixed now.

However, there is still an issue with the camera now. It seems to jitter a little bit when walking (almost not noticable), it jitters even more when climbing and the camera goes completely insane when either walking while crouching or dying. Also, when running against walls, the camera can see through the meshes. But the latter might have to do with some field of view settings that I need to tweak.

Anyway, the camera jitter during the different UFPS states of my controllable character is really annoying. I hope someone can help me with this, because both AC and UFPS are amazing assets and if I can manage to make them work properly, they can really help me a lot with my current game! :)

Comments

  • edited September 2014
    If helpful, here's a step-by-step breakthrough of what I did to get the camera to jitter:

    - Using Unity v4.5.2f1 (free version) I set up a new project and then import both the Adventure Creator (v1.3.8b) and UFPS (v1.4.7c) packages.
    - I get the following errors, which I ignore (they dissapear later on).
    1. There are inconsistent line endings in the 'Assets/UFPS/Base/Scripts/Gameplay/Player/Local/Interaction/vp_Grab.cs' script. Some are Mac OS X (UNIX) and some are Windows.
    This might lead to incorrect line numbers in stacktraces and compiler errors. Many text editors can fix this using Convert Line Endings menu commands.
    2. There are inconsistent line endings in the 'Assets/UFPS/Base/Scripts/Core/Utility/vp_PoolManager.cs' script. Some are Mac OS X (UNIX) and some are Windows.
    This might lead to incorrect line numbers in stacktraces and compiler errors. Many text editors can fix this using Convert Line Endings menu commands.
    - I open up Adventure Creator’s New Game Wizzard and set it up to create a 3D game with Ultimate FPS as a control method. (Furthermore: context sensitive interaction method, mouse over detection method and the standard GUI).
    - I then follow this tutorial’s exact steps, using UFPS’ Camera&Controller prefab and ending with locking the cursor on start: http://www.iceboxstudios.co.uk/node/130 (I don’t use the Run in Background part at the end, since I want to keep using AC’s logic).
    - Additionally, I give both the player prefab and it’s child camera the run and crouch states.
    - In the Player Settings, I fill in “UltimateFPSIsPresent” in the Scripting Define Symbols box.
    - I copy UFPS’ Camera&Controller prefab into my own Resources folder and rename it to Camera&Controller_AC, check the ‘force cursor’ and add Adventure Creator’s Player & Path scripts. I also give the game object the Freeze state and it’s child camera as well. I set the camera’s tag to FirstPersonCamera and disable it’s Audio Listener component. Finally, I assign it as the Player in AC’s Game Editor.
    - I create a terrain for the character to walk on and put in a 3D model that I made. I give the 3D model a mesh collider. Finally, I add a directional light.
    - When I press play, I get the warning that no NavMesh is found, which I ignore (since I won’t be using the point-and-click style control method) and an error that UFPS’s Axis Mouse X is not setup.
    To fix this, I add two more states to Unity’s InputManager: Mouse X (mouse movement, X axis, not inverted, gravity 0 and dead 0.19) and Mouse Y (mouse movement, Y axis, not inverted, gravity 0 and dead 0.19).
    - Camera jitter occurs, significantly noticable when crouching. (Also when dying or climbing, after I added those states to the player and camera and include a ladder and AI turret to the scene).
  • A difficult one.  It's less noticeable on my machine, but the symptoms suggest it's due to a discrepancy between the time that AC and UFPS update their cameras.

    AC basically "sticks" it's MainCamera to whichever the currently active camera is.  It does this every frame, by way of the StateHandler script's Update function.  If you could, please experiment to see which gives you the better result: you'll have a better measurement of improvement, since it's more noticeable to you.  Try temporarily renaming Update () to LateUpdate (), and see if that makes a difference.
  • Yes, that actually solved the problem! Maybe you can set this function to be a LateUpdate in future releases of AC, since the jitter really was annoying.

    Thanks Chris! :)
  • solved here too!
  • Nice - were it not that, I would've been a bit stuck for suggestions.
  • Return of the camera jitter!

    Interesting stuff... When a cutscene runs the action "Engine: End Game" with the command set to Reset Game or Reset Scene, the scene will play again but the camera jitter returns, even if the StateHandler's script has been altered so the Update function is now a LateUpdate.

    I'm probably overseeing a small thing here, but it's getting late and I really have no clue what is causing the problem to return :/
  • Annoying.  Perhaps it's to do with the Script Execution order.  Try moving StateHandler around, and see what improvements it might make.  You can modify it by finding the StateHandler script, and choosing "Execution Order.." in the top-right of the Inspector.
  • edited September 2014
    You're the man. The jitter seems to be fone for good now. This is how I set the Execution Order up:

    image
  • Thanks - I'll add it to the tutorial.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.