character controller sample project

Attached is a simple character controller sample project.

This does not do animation.

(There is a NetworkTransform bug with syncing rotation for CharacterControllers. This projects contains a workaround script that can be used until that is fixed).

2155288–142335–netcontroller.zip (77.2 KB)

1 Like

Thank you for this, great for my needs :slight_smile: Will basic animation be added?

Hey Sean,

I was trying to get two players’ animated characters working over the network. I wasn’t sure how to correctly sync their animations. The input layer uses isLocalPlayer, and I was hoping the sync character controller option would be enough. When i used that, it wouldn’t move at all (not just a rotation issue).

If you’d like to check it out, here’s the github link and the SO question.

1 Like

In your ThirdPersonUserControl script, add:

        [Command]
        void CmdMove(Vector3 move, bool crouch, bool jump)
        {
            RpcMove(move, crouch, jump);
        }

        [ClientRpc]
        void RpcMove(Vector3 move, bool crouch, bool jump)
        {
            if (isLocalPlayer)
                return;

            m_Move = move;
            m_Crouch = crouch;
            m_Jump = jump;
            m_Character.Move(move, crouch, jump);
        }

Then call CmdMove for the local player, maybe in Update().

1 Like

Thanks much @seanr !

I removed the [SyncVar]'s in the script, in addition to that (since the RPC has the updated arguments at any point) and it works fine.

Why didn’t the earlier version work though? Since the movement variables were synchronized, it should have run the animation until each update, right?
Also, when would I set NetworkTransform.TransformSyncMode to Sync Character Controller?

1 Like

Thanks。
非常感谢。

I want to ask the same question as raja.bala:
Why didn’t the earlier version work though? Since the movement variables were synchronized, it should have run the animation until each update, right?
Also, when would I set NetworkTransform.TransformSyncMode to Sync Character Controller?

Thanks Sean, it’s great. I still want to ask: when should we use NetworkedTransform (sync Character Controler)?

How can I get it to work? :frowning: