Skip to content

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

@leeprobert

Description

@leeprobert

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions