diff --git a/Assets/Mirror/Components/Experimental/NetworkRigidbody.cs b/Assets/Mirror/Components/Experimental/NetworkRigidbody.cs index 8abeeb1ed..fabf0bbfd 100644 --- a/Assets/Mirror/Components/Experimental/NetworkRigidbody.cs +++ b/Assets/Mirror/Components/Experimental/NetworkRigidbody.cs @@ -2,6 +2,8 @@ namespace Mirror.Experimental { + [AddComponentMenu("Network/Experimental/NetworkRigidbody")] + [HelpURL("https://mirror-networking.com/docs/Components/NetworkRigidbody.html")] public class NetworkRigidbody : NetworkBehaviour { static readonly ILogger logger = LogFactory.GetLogger(typeof(NetworkRigidbody)); diff --git a/Assets/Mirror/Components/Experimental/NetworkRigidbody.cs.meta b/Assets/Mirror/Components/Experimental/NetworkRigidbody.cs.meta index 359ab8c99..1610f0a73 100644 --- a/Assets/Mirror/Components/Experimental/NetworkRigidbody.cs.meta +++ b/Assets/Mirror/Components/Experimental/NetworkRigidbody.cs.meta @@ -5,7 +5,7 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {instanceID: 0} + icon: {fileID: 2800000, guid: 7453abfe9e8b2c04a8a47eb536fe21eb, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/doc/Components/NetworkRigidbody.md b/doc/Components/NetworkRigidbody.md new file mode 100644 index 000000000..fa68471af --- /dev/null +++ b/doc/Components/NetworkRigidbody.md @@ -0,0 +1,21 @@ +# Network Rigidbody + +> The Network Rigidbody classed as "Experimental" for now so please share any problems or bugs you find with it and use at your own risk if production builds. + +The Network Rigidbody component synchronizes velocity and other properties of a rigidbody across the network. This component is useful when you have a non-kinematic rigidbody that have constant forces applied to them, like gravity, but also want to apply forces or change velocity to that rigidbody or server or client with authority. For example, objects that move and jump using rigidbody using gravity. + +A game object with a Network Rigidbody component must also have a Network Identity component. When you add a Network Rigidbody component to a game object, Mirror also adds a Network Identity component on that game object if it does not already have one. + +Network Rigidbody works best when there is also a NetworkTransform for the object to keep position as well as velocity in sync. + +![Network Rigidbody inspector](NetworkRigidbody.png) + +By default, Network Rigidbody is server-authoritative unless you check the box for **Client Authority**. Client Authority applies to player objects as well as non-player objects that have been specifically assigned to a client, but only for this component. With this enabled, value changes are send from the client to the server. + +The **Sensitivity** options allow you to set a minimum thresholds before values are send over network. This helps minimize network traffic for very small changes. + +For some object you may not want them to rotate but don't need to sync the Angular Velocity. The **Clear Angular Velocity** will set the Angular Velocity to zero each frame causing the minimizing when objects rotation. The same can apply to **Clear Velocity**. If **Clear Velocity Velocity** is enabled then clear is ignored. + +Normally, changes are sent to all observers of the object this component is on. Setting **Sync Mode** to Owner Only makes the changes private between the server and the client owner of the object. + +You can use the **Sync Interval** to specify how often it syncs (in seconds). This applies both to Client Authority and Server Authority. diff --git a/doc/Components/NetworkRigidbody.png b/doc/Components/NetworkRigidbody.png new file mode 100644 index 000000000..241e9b1b1 Binary files /dev/null and b/doc/Components/NetworkRigidbody.png differ diff --git a/doc/Components/index.md b/doc/Components/index.md index beff4872b..32007440f 100644 --- a/doc/Components/index.md +++ b/doc/Components/index.md @@ -24,6 +24,8 @@ These core components are included in Mirror: The Network Match Checker component controls visibility of networked objects based on match id. - [Network Proximity Checker](NetworkProximityChecker.md) The Network Proximity Checker component controls the visibility of game objects for network clients, based on proximity to players. +- [Network Rigidbody](NetworkRigidbody.md) + The Network Rigidbody synchronizes velocity and other properties of a rigidbody across the network. - [Network Room Manager](NetworkRoomManager.md) The Network Room Manager is an extension component of Network Manager that provides a basic functional room. - [Network Room Player](NetworkRoomPlayer.md)