Rigidbody movement

Options
In my 2D game, two players share several scene rigidbodies that they can "bump" -- adding a force to the object.

When the Master client bumps the object, the force is appropriately applied.

When any other client bumps the object, the force is not applied effectively. It appears that the rigidbody immediately begins smoothing its movement back to its initial point.

What's the best way to fix this?

Comments

  • Tobias
    Options
    In PUN, only one user is the "owner" of an object. This makes him/her the controlling client for an object. This client sends the position (or other) updates and the other clients just follow the lead and can't affect the object (except locally).
    If we didn't do this, any 2 clients might send different positions for an object at the same time. No client would know which position would be correct.

    If it's just a few objects, you could drop the PhotonViews and come up with your own IDs. You can send RPCs as "AllThroughServer". This makes all clients (even the sender) execute the RPC when it's "back" from the server. This gives you a sequence for RPCs.
    While an object can be bumped, apply only the first RPC to bump the object and ignore other bumps until the fist bump is done.