From 1f30306061de7d439d324ec9fb48793510c51c12 Mon Sep 17 00:00:00 2001 From: mischa Date: Sun, 28 Jan 2024 12:37:20 +0100 Subject: [PATCH] adjust code --- Assets/Mirror/Examples/Shooter/Scripts/PlayerWeapon.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Assets/Mirror/Examples/Shooter/Scripts/PlayerWeapon.cs b/Assets/Mirror/Examples/Shooter/Scripts/PlayerWeapon.cs index 24d9ed724..dfd14ae46 100644 --- a/Assets/Mirror/Examples/Shooter/Scripts/PlayerWeapon.cs +++ b/Assets/Mirror/Examples/Shooter/Scripts/PlayerWeapon.cs @@ -67,7 +67,8 @@ void FireWeapon() { // prediction: apply bullet force locally and send command to server ApplyBulletForce(rigid, hit.normal, weapon.impactForce); - if (!isServer) CmdApplyBulletForce(predictedPhysics.target, hit.normal, weapon.impactForce); // not in host mode + PredictedRigidbody target = predictedPhysics.target.GetComponent(); + if (!isServer) CmdApplyBulletForce(target, hit.normal, weapon.impactForce); // not in host mode } } }