Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Netcode for Entities input delay and Cinemachine camera jittering on predicted ghost

Discussion in 'NetCode for ECS' started by billfrank904, Nov 16, 2023.

  1. billfrank904


    Aug 29, 2018
    Hi, i am currently building a racing game using DOTS and netcode for entities where i use Dots for the physics part and GameObjects for the visual part and i came across two challenges
    1, Is there a way for me to have my local ghost immediately consume my inputs on the local machine (and not wait for the server to send the input) then reposition the ghost if the transform of the local ghost and that of the server are too far apart?
    2, When i use cinemachine's xyz damping's the camera jitters a lot (probably because of the resimulation) so is there a walkaround for me to have a smooth camera while my vehicle moves?
  2. Gregoryl


    Unity Technologies

    Dec 22, 2016
    I can answer the Cinemachine part. Cinemachine's damping requires smooth movement of the target. If the target moves irregularly, there's no amount of camera damping that can smooth it out. The solution is to interpolate your simulated positions correctly, according to the elapsed deltaTime. If for some reason smooth movement is not possible, then the alternative is to rigidly fix your camera to the moving object. That way, the object won't jitter in the frame - although the background will, but that's generally less irritating. However, it's much better to make the movement smooth.
    billfrank904 likes this.