The attached video:
Player is the white circle. CSP is working great for player movement.
The yellow puck is a PredictedObject rigidbody2D, also working fine.
I'm trying to find a way to simulate on the client an interaction that happens with a non-owned object. In this case, when I click the mouse, it's sending an RPC with RunLocally=true through a player controller to the server which applies the following:
public void ProcessHit()
{
if (IsServer)
{
_rigidbody.velocity = new Vector2();
_rigidbody.AddForce(new Vector2(100, 100));
}
// Flash Red
_flashTimer = _flashTimerMax;
visualObject.GetComponent<SpriteRenderer>().color = _flashColor;
}
As can be seen in the video with the puck immediately changing color, I can predict the action about to happen to the core. However I can't find a way to predict the movement that's about to happen to the core. All the examples I've found are just relying on collision for this prediction.
The [Replicate] / [Reconcile] pattern seems to only worked for owned objects, and the player doesn't own the puck.
Trying to add the velocity on the client side in ProcessHit doesn't work either, as the physics simulation is out of whack on the client (Physics is constantly running extra steps from reconciling the player, so applying forces locally is completely unpredictable).
I'm really stumped on how to get this working as it SHOULD be doable... somehow.