com.unity.netcode.gameobjects
com.unity.netcode.gameobjects copied to clipboard
Add defaultIsKinematic variable to NetworkRigidbody
NetworkRigidbody automatically sets Rigidbody.isKinematic to false on server side.
Please add dafaultIsKinematic variable to NetworkRigidbody so I should decide if I want to init a NetworkObject with kinematic RigidBody on server side network spawn.
My current solution is to create defaultIsKinematic variable in my own Item script (inherited from NetworkBehaviour):
- Save original position in Awake if defaultIsKinematic is true (I believe that this would not be necessary if defaultIsKinematic variable would be included in original NetworkRigidbody script)
- In OnNetworkSpawn on server side I call IEnumerator to wait for next frame -> I set rigidBody.isKinematic value to defaultIsKinematic value and reset position to original position.
Hi @W3ktor,
I am assuming you are using NGO v1.11.0 (or some earlier v1.x.x version)?
The NetworkRigidbodyBase was updated to be more modular and to provide you with "out of the box" ways to handle automatically setting the Kinematic state.
NGO v2.0.0 provides you with this feature.
👍
Nice, thanks for the info!