Adding Vector3 to transform.position looks strange?

Options
Okay, I've had this question closed for being a duplicate and I have a feeling nobody answered as I didn't give enough detail. So don't close this question yet, JohnTube. I'm making my player move by adding a Vector3 to his position, and it works fine on my client. The problem is, while the player moves perfectly on my client, other players won't see me "dash", more just move a little bit upward. It's not like the players are going out of sync, and I believe the problem is how the player lerps on other clients. How can I get the same behaviour on other clients? I have a Photon View, Photon Transform View and a Photon Rigidbody 2D View on my player if that helps.

Answers

  • Gage_IAG
    Options
    So youre exactly right as it seems. However, since your "dash" ability is exactly that, your other players wont receive that quick movement update, they will process the movement syncing just as you have it outlined in either a PhotonSerializeView method or a observed TransformView.

    Now, if youre wanting other players to view your dash ability at the same rate you view it (with some delay) then youll need to rethink how youre processing movement in PUN (See Bolt, etc for more precisely synced actions).

    To allow players to view your dash, you dont use a transform view, use a custom observed component that can sync a start and end point vector3 with a lerp with a boolean check to state when your dashing and when youre not, if not then just vector lerp sync as normal, if you are perhaps you can sync with a MoveTowards. You can put this in a SerializeView method for the receiving end of the stream.

    Its untested, so no promises.
  • LeytonMate
    edited April 2019
    Options
    @Gage_IAG I could do that, but the problem is is that I don't know how to find out where the player will end up once dashing. When you dash, it moves you in the direction of the cursor multiplied by a speed for a certain amount of time. How can I find out where he'll be by the end of that time so I can sync it?