|
|
@@ -23,6 +23,12 @@ public class ArrowSync : MonoBehaviour
|
|
|
transform.rotation = Quaternion.Lerp(transform.rotation, rotation, t);
|
|
|
}
|
|
|
|
|
|
+ void UpdatePosAndRotImmediate() {
|
|
|
+ transform.position = position;
|
|
|
+ Head().position = transform.position;
|
|
|
+ transform.rotation = rotation;
|
|
|
+ }
|
|
|
+
|
|
|
public Transform Head() {
|
|
|
return transform.Find("Head");
|
|
|
}
|
|
|
@@ -117,7 +123,12 @@ public class ArrowSync : MonoBehaviour
|
|
|
if (syncData.HasArrowCameraTemplate3()) {
|
|
|
hasBlockByTree = syncData.GetArrowCameraTemplate3().Item1;
|
|
|
}
|
|
|
- UpdatePosAndRot(1f);
|
|
|
+ if (hitTargetAnimalInfo != null) {
|
|
|
+ //因为击中的是动物,这里就使用射中时第一帧的数据,可避免跟主机的表现产生差异
|
|
|
+ SyncDataUtil.StrToVec3(hitTargetAnimalInfo[4], position);
|
|
|
+ SyncDataUtil.StrToQuat(hitTargetAnimalInfo[5], rotation);
|
|
|
+ }
|
|
|
+ UpdatePosAndRotImmediate();
|
|
|
((ArrowCameraTemplate3) arrowCameraComp.arrowCameraTemplate).beforHitWhenSync(hasBlockByTree);
|
|
|
if (hitTargetAnimalInfo != null) {
|
|
|
int onlineID = int.Parse(hitTargetAnimalInfo[0]);
|
|
|
@@ -125,7 +136,10 @@ public class ArrowSync : MonoBehaviour
|
|
|
TargetAnimal[] targetAnimals = GameObject.FindObjectsOfType<TargetAnimal>();
|
|
|
foreach (var item in targetAnimals) {
|
|
|
if (item.GetOnlineID() == onlineID) {
|
|
|
+ //因为击中的是动物,箭挂在动物身上,之后不需要用网络数据来同步表现,而且这样表现力更好
|
|
|
this.transform.SetParent(item.targetAnimalParts[partIndex]);
|
|
|
+ transform.localPosition = SyncDataUtil.StrToVec3(hitTargetAnimalInfo[2]);
|
|
|
+ transform.localRotation = SyncDataUtil.StrToQuat(hitTargetAnimalInfo[3]);
|
|
|
hasAttachAnything = true;
|
|
|
break;
|
|
|
}
|