FishNet icon indicating copy to clipboard operation
FishNet copied to clipboard

Client-Side Prediction V1 becomes Unstable After Changing Colliders during Runtime

Open Midnight-Sink opened this issue 3 years ago • 3 comments

Important

If General, Description, and Replication are not completed the issue will be closed immediately.

General Unity version: 2021.3.15f1 (Personal) Fish-Networking version: 3.5.8hf0 Link on our Discord where you troubleshot the issue(on Discord click the three dots next to the message, then Copy Message Link): https://discord.com/channels/424284635074134018/1104850498290462821/1108911919529742397 https://discord.com/channels/424284635074134018/1034477094731784302/1109503520413057205

The second link has a short video of the issue, recreated in the rigidbody prediction demo scene. I have also attached one here.

Description If the collider(s) under a predicted rigidbody object are modified during runtime, the prediction will become unstable for the client. This includes object vibrations (for both the rigidbody and the visual object), sinking into the ground (visual only), and objects floating around. Once the object is touched by the player the visual will snap back into position, but will quickly begin it's erratic behavior again. In my testing the host would only at most see minor vibrations.

I encourage investigating if this occurs on CSP V2 as well.

Replication Steps to reproduce the behavior: Below are the steps to reproduce the issue on the rigidbody prediction demo scene.

  1. Create a new Unity project, and import FishNet from the package manager window.
  2. Open the "Rigidbody Prediction" scene under Assets/Example/All/Prediction/Rigidbody/
  3. Set the default prefabs in the NetworkManager object
  4. Create a new empty object, and add these components: Rigidbody, NetworkObject, PredictedObject, CubeMesh (Custom script, screen shot of this attached)
  5. Create another empty object and make it a child of the one created in step 4. Add these components: MeshFilter, MeshRenderer
  6. In the PredictedObject component, set the Graphical Object to the object created in step 5. Set the Prediction Type to Rigidbody and then set the Rigidbody to the object created in step 4.
  7. In the CubeMesh component, set the Visual to the object created in step 5. Set M to the default unity cube mesh. Set the material to any material.
  8. Save the object created in step 4 as a prefab. Add 4 of them to the scene, all at position (0,0,0).
  9. Build the project.
  10. Run two instances of the project. Observe the cubes' erratic behavior.

Expected behavior The client-side prediction should remain acting as normal (stable) as objects that did not have their collider modified after the collider is changed.

Screenshots

https://github.com/FirstGearGames/FishNet/assets/40347820/cec6b919-8702-4ad2-aa99-312e78cfd2e0

ProjectScene

CubeMesh

Midnight-Sink avatar May 20 '23 17:05 Midnight-Sink

I think this is due to the face that the spawned object doesn't have a predicted spawn component on it, but I am checking

Midnight-Sink avatar May 20 '23 21:05 Midnight-Sink

That was the issue, I have attached a screen shot of the corrected script in case someone encounters this. Might not be the best way to accomplish this, but it works.

CubeMeshCorrected

Midnight-Sink avatar May 20 '23 21:05 Midnight-Sink

It's probably because you were likely not changing the colliders for everyone and the server as well.

On Sat, May 20, 2023, 5:52 PM Derek Lore @.***> wrote:

That was the issue, I have attached a screen shot of the corrected script in case someone encounters this. Might not be the best way to accomplish this, but it works.

[image: CubeMeshCorrected] https://user-images.githubusercontent.com/40347820/239710612-ce26a75d-891c-4a74-8e33-06457cf0d098.png

— Reply to this email directly, view it on GitHub https://github.com/FirstGearGames/FishNet/issues/378#issuecomment-1556022076, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGPJC3SRCNIWXZEM6KPQ5SDXHE4ILANCNFSM6AAAAAAYI24SCI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

FirstGearGames avatar May 20 '23 22:05 FirstGearGames