Added many quality of life changes to pushable objects and removed the delay when hitting an object (hopefully) to allow for players to be able to push objects even if they have a longer ping time (too long will result in inconsistent results).
This comes from allowing a player to be the 'owner' of an object after they hit this.
Note, this should probably be given a timeout in the future as this is not the best solution for the problem as objects they 'own' are deleted when they disconnect. Maybe move this to be another value in the future so this error does not occur as often.
Also cleaned up interactions between IPushable objects and IMovingGroundObjects by adding the two classes RelativeVelocityMovementTracking and RelativeVelocityRigidbodyTracking that allow for transfer of movement to players based on relative velocity. This will stop a player for shooting off at supersonic speeds while pushing a box they are standing on top of (despite how fun that bug can be).
Note, this is based off of the frame by frame player velocity. This should probably be transitioned to being based of a smoothed player velocity (the network rigidbody already does this for Pushable objects). This will involve writing some method of smoothing the player's velocity and may take a bit of extra work to get fully correct.
Also of note, there seems to be a small error with the NetworkRigidbody, when it changes owners quickly clients will try to write to the variable without permission, this is probably due to the owner change state not being propagated to the client fast enough. This could be mitigated by giving the client ownership a short period (such as 0.05 seconds) but would involve tuning based on the situation. This has been temporarily mitigated by allowing for all clients to write to the NetworkRigidbody component (instead of just the owner) and therefore, when conflicting writes are received by the server from non owners, they are either ignored or blended between differnet values. This might result in jittery situations if multiple clients are all pushing the same object at once but this probably wont happen.
For larger game objects such as a see-saw or large box players need to push this might be better managed as a custom script to handle Pushable events. A small delay is probably acceptable.
How Has This Been Tested?
This has been tested in the following situation
On the server pushing an object alone
On the server with one client connected. Tested passing object between server and client, pushing object as client, and pushing object as server
On the server with two clients connected.
Tested passing object between client and server
Tested passing object between clients
Tested pushing object as client or server after having a differnet player push the box
These tests all occurred on the same computer with essentially zero network transport delay, should test over internet as well.
Checklist:
[x] My code follows the style guidelines of this project
[x] I have performed a self-review of my own code
[x] I have commented my code, particularly in hard-to-understand areas
[x] I have made corresponding changes to the documentation
Ok, so local control works very well but running into some kind of permission error. Going to just push the object locally and on the server and hope it works itself out :D
Description
Added many quality of life changes to pushable objects and removed the delay when hitting an object (hopefully) to allow for players to be able to push objects even if they have a longer ping time (too long will result in inconsistent results).
This comes from allowing a player to be the 'owner' of an object after they hit this.
Also cleaned up interactions between IPushable objects and IMovingGroundObjects by adding the two classes RelativeVelocityMovementTracking and RelativeVelocityRigidbodyTracking that allow for transfer of movement to players based on relative velocity. This will stop a player for shooting off at supersonic speeds while pushing a box they are standing on top of (despite how fun that bug can be).
Also of note, there seems to be a small error with the NetworkRigidbody, when it changes owners quickly clients will try to write to the variable without permission, this is probably due to the owner change state not being propagated to the client fast enough. This could be mitigated by giving the client ownership a short period (such as 0.05 seconds) but would involve tuning based on the situation. This has been temporarily mitigated by allowing for all clients to write to the NetworkRigidbody component (instead of just the owner) and therefore, when conflicting writes are received by the server from non owners, they are either ignored or blended between differnet values. This might result in jittery situations if multiple clients are all pushing the same object at once but this probably wont happen.
How Has This Been Tested?
This has been tested in the following situation
These tests all occurred on the same computer with essentially zero network transport delay, should test over internet as well.
Checklist: