Soccer ball in motion jitters when Opsive Character is running or there is any camera movement

cheeze94

New member
Hey everyone,

Enjoying UCC so far but ran into a oddly strange yet simple issue.

Running into a strange issue which seems fairly easy to resolve but not sure why this is only happening with the Opsive character controller and not with the other character controllers I've used.

When my character interacts with a soccer ball that has a rigidbody on it and interpolation set to Interpolate, the ball begins to jitter on screen:

Note that the character's locomotion is set to FixedUpdate.




I was able to resolve this jitter by changing the character's locomotion to Update instead and here is the result:


Here is the soccer ball's rigidbody for reference:

1610120234423.png

Now I have two questions:

Is there a better way to address this issue? This issue only happens when the camera is in motion. If I disable the camera scripts and keep the camera static, and my character is in FixedUpdate or Update mode, there are no jitter issues when the soccer ball is kicked.

Would setting it to update cause the character to behave differently on people's computer's with different frame rates? I'm not sure if setting the target framerate and character's locomotion to update just to resolve this is a good solution in the long run.
 
Glad you are enjoying UCC!

Is there a better way to address this issue? This issue only happens when the camera is in motion. If I disable the camera scripts and keep the camera static, and my character is in FixedUpdate or Update mode, there are no jitter issues when the soccer ball is kicked.
That's the correct method. This will enable the camera to run in update so the ball doesn't jitter.

Would setting it to update cause the character to behave differently on people's computer's with different frame rates? I'm not sure if setting the target framerate and character's locomotion to update just to resolve this is a good solution in the long run.
No, you'll just want to make sure you set the target frame rate. https://docs.unity3d.com/ScriptReference/Application-targetFrameRate.html
 
Glad you are enjoying UCC!


That's the correct method. This will enable the camera to run in update so the ball doesn't jitter.


No, you'll just want to make sure you set the target frame rate. https://docs.unity3d.com/ScriptReference/Application-targetFrameRate.html

If I set the target framerate to 300, but not everyone's computer can handle 300fps, then wouldn't that cause the behavior to behave differently for everyone (especially as regard to WebGL). For example, I have implemented some basic multiplayer with Mirror (network transform and animator). Would it act differently? Let's on a computer, the framerate is 30fps and the other one is 150fps, and the target framerate is 300. Would that cause it to be different for everyone?



Or is there a way just to update the camera in the Update loop and everything else in FixedUpdate? Would that create new jitter issues?
 
If you are doing a server authoritative multiplayer game then you will want to use fixed update. The camera also needs to update within fixed update because if you don't then your character will have jitter.

I haven't tried playing with syncing rigidbody physics over the network in a fixed time step. You may need to create a new controller for your ball that handles physics while also being able to sync over the network with a fixed time step.
 
Thank you for the prompt responses. I'll continue taking a look into this and try to resolve the Jitter while using FixedUpdate. Maybe changing the camera to be cinemachine camera? Not sure if that would do much.
 
The camera's update location will need to always be the same as the physics update location, otherwise there will be jitter.
 
Is there a way to set the camera to Update mode without needing to set Target Framerate and achieve the same behavior for different players? How is the Opsive character controller expected to interact with rigidbody objects without jitter?
 
For a consistent framerate for each player with a multiplayer setup you should use FixedUpdate. Update will always be variable and setting the targetFrameRate isn't guaranteed to have a consistent framerate.

Rigidbodies are not deterministic though so for a multiplayer game you'll likely need a determinstic controller for the ball. As a test I set the controller to FixedUpdate and pushed the ball. When I did this there wasn't any jitter: https://streamable.com/z3a2jd
 
Interesting. The video I show above was with a really simple Nolan character set to Fixed Update and a simple Rigidbody on a sphere as well yet I saw the jitter.

But I saw your video and you have it set to FixedUpdate and saw no jitter. I wonder if it's a Unity 2020 thing? I'll try it in Unity 2019 and post back my results.
 
I was using 2018.4. When I tried 2020.2 I noticed the jitter on the ball. When I switched the ball's rigidbody to extrapolate while having the character in fixed update the ball force was smooth. Changing the timestep is also a good solution.
 
Top