PredictionRigidbody
This class provides accurate simulations and re-simulations when applying outside forces, most commonly through collisions.
Using PredictionRigidbody is very straight forward. In short, you move from applying force changes to the rigidbody onto the PredictionRigidbody instance instead.
There are a few more steps, but equally simple.
This guide assumes you are familiar with the Getting Started section.
This bit shows the changes for adding forces to your rigidbody, or rather now the PredictionRigidbody.
PredictionRigidbody must also be reconciled. Be sure to include it in your reconcile data.
This is also covered in the Getting Started guide.
In your reconcile method you must update your PredictionRigidbody reference using the value from your reconcile data.
To add outside forces to your rigidbody you will want to apply them instead to the PredictionRigidbody. As mentioned at the very beginning, this is most commonly seen with collisions.
For triggers and collisions to work properly with prediction you must use our NetworkTrigger/NetworkCollision components. Otherwise, due to a Unity limitation, such interactions would not work. You can learn more about those components here.
Fun fact: Fish-Networking is the only framework that has the ability to simulate Enter/Exit events with prediction; not even Fusion does this!
Last updated