Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting linear velocity of a kinematic body is not supported error in 2022.1.0 #1

Open
leeprobert opened this issue Sep 19, 2023 · 1 comment

Comments

@leeprobert
Copy link

Thank you for pulling together this prototype for the NetCode Third Person Character Controller. It has saved me a lot of work figuring it out. I think it is nearly there, but I have noticed an error. This error only gets logged when you attempt to move the Player on the 'client' ... the 'host' player (and therefore the server) is fine.

Setting linear velocity of a kinematic body is not supported.
InvalidOperationException: Client is not allowed to write to this NetworkVariable
  at Unity.Netcode.NetworkVariable`1[T].set_Value (T value) [0x0003a] in <693656ca012e4e968ef2beda232c1ee7>:0 
  at Unity.Netcode.Components.NetworkTransform.TryCommitTransform (UnityEngine.Transform& transformToCommit, System.Boolean synchronize) [0x0006d] in <719eea6d5f2c4fb68836733d2ee1d20c>:0 
  at Unity.Netcode.Components.NetworkTransform.OnUpdateAuthoritativeState (UnityEngine.Transform& transformSource) [0x00038] in <719eea6d5f2c4fb68836733d2ee1d20c>:0 
  at Unity.Netcode.Components.NetworkTransform.TryCommitTransformToServer (UnityEngine.Transform transformToCommit, System.Double dirtyTime) [0x000b4] in <719eea6d5f2c4fb68836733d2ee1d20c>:0 

I had a look into the linear velocity bug and found this on the forum: https://forum.unity.com/threads/kinematic-rigidbodies-no-longer-holding-velocity-property.1227075/

I tested the theory by commenting out this line: m_Rigidbody.velocity = v; from the onAnimatorMove method. I wasn't able to move the player but the error disappeared. I think the error related to writing to the NetworkVariable must be related to this.

Do you have any thoughts? I will update here if I find a solution.

@leeprobert
Copy link
Author

Ok, I was able to get rid of the linear velocity error by changing that line to: m_Rigidbody.MovePosition(m_Rigidbody.position + v); - although it makes the speed of movement crazy fast.

It also didn't fix the issue with writing the NetworkVariable ... this seems to be unrelated after all.

It must be an issue with the client writing the server variable. Any tips on where this would be happening?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant