Trigger events still fire but collision events won't fire when colliding with other networked Rigidbody instances. On the clients, the Rigidbody is kinematic.On the server, all collision and trigger events (such as OnCollisionEnter) fire as expected and you can access (and change) values of the Rigidbody (such as velocity).Some collision events aren't fired when using NetworkRigidbody. To use NetworkRigidbody, add a Rigidbody, NetworkTransform, and NetworkRigidbody component to your NetworkObject. That way, the physics simulation runs on the authoritative instance, and the resulting positions synchronize on the non-authoritative instances, each with their RigidBody being Kinematic, without any interference. Whether the NetworkTransform is server authoritative (default) or owner authoritative, the NetworkRigidBody authority model will mirror it. Authority is determined by the NetworkTransform component (required) attached to the same GameObject as the NetworkRigidbody. NetworkRigidbody is a component that sets the Rigidbody of the GameObject into kinematic mode on all non-authoritative instances (except the instance that has authority). To enable network physics, add a NetworkRigidbody component to your object. Netcode for GameObjects (Netcode) has a built in approach which allows for server-authoritative physics where the physics simulation only runs on the server. You'd have to use RPC's, or come up with a way to re-allocate viewId's to change the owner, I think. There are many different ways to do physics in multiplayer games. You can't really have an object that is controlled by multiple players using state synchronization/OnSerializeNetworkView (), because only the owner could write to the bitstream and there can only be one owner.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |