use new approach to sync ped

This commit is contained in:
in0finite 2022-04-26 23:12:10 +02:00
parent 38f5995c92
commit 393d3d45da
2 changed files with 12 additions and 26 deletions

View file

@ -372,7 +372,7 @@ GameObject:
- component: {fileID: 114879899237604226} - component: {fileID: 114879899237604226}
- component: {fileID: 114220037769542022} - component: {fileID: 114220037769542022}
- component: {fileID: 8031585062060932984} - component: {fileID: 8031585062060932984}
- component: {fileID: 4594788420466467901} - component: {fileID: 3337177822774145499}
- component: {fileID: 7038296094652462326} - component: {fileID: 7038296094652462326}
- component: {fileID: 614328402837403552} - component: {fileID: 614328402837403552}
m_Layer: 11 m_Layer: 11
@ -514,7 +514,7 @@ MonoBehaviour:
visible: 0 visible: 0
m_AssetId: 9d45d42a7408c1e4ab325d6840364b84 m_AssetId: 9d45d42a7408c1e4ab325d6840364b84
hasSpawned: 0 hasSpawned: 0
--- !u!114 &4594788420466467901 --- !u!114 &3337177822774145499
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
@ -523,31 +523,17 @@ MonoBehaviour:
m_GameObject: {fileID: 1273918895060814} m_GameObject: {fileID: 1273918895060814}
m_Enabled: 1 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2f74aedd71d9a4f55b3ce499326d45fb, type: 3} m_Script: {fileID: 11500000, guid: 7810004c3617c05419e4e60874dc18a7, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
syncMode: 0 syncMode: 0
syncInterval: 0.05 syncInterval: 0.05
clientAuthority: 0 m_transformToSync: {fileID: 4388436116821042}
sendInterval: 0.05 m_transformSyncParameters:
syncPosition: 1 useSmoothDeltaTime: 1
syncRotation: 1 clientUpdateType: 0
syncScale: 0 constantVelocityMultiplier: 1
interpolatePosition: 1 lerpFactor: 30
interpolateRotation: 1
interpolateScale: 0
bufferTimeMultiplier: 1
bufferSizeLimit: 64
catchupThreshold: 4
catchupMultiplier: 0.1
onlySyncOnChange: 1
bufferResetMultiplier: 5
positionSensitivity: 0.01
rotationSensitivity: 0.01
scaleSensitivity: 0.01
showGizmos: 0
showOverlay: 0
overlayColor: {r: 0, g: 0, b: 0, a: 0.5}
--- !u!195 &7038296094652462326 --- !u!195 &7038296094652462326
NavMeshAgent: NavMeshAgent:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View file

@ -9,7 +9,7 @@ namespace SanAndreasUnity.Behaviours
{ {
public partial class Ped public partial class Ped
{ {
public NetworkTransform NetTransform { get; private set; } public CustomNetworkTransform NetTransform { get; private set; }
[Range(1f / 60f, 0.5f)] [SerializeField] float m_inputSendInterval = 1f / 30f; [Range(1f / 60f, 0.5f)] [SerializeField] float m_inputSendInterval = 1f / 30f;
float m_timeSinceSentInput = 0f; float m_timeSinceSentInput = 0f;
@ -57,7 +57,7 @@ namespace SanAndreasUnity.Behaviours
void Awake_Net() void Awake_Net()
{ {
this.NetTransform = this.GetComponentOrThrow<NetworkTransform>(); this.NetTransform = this.GetComponentOrThrow<CustomNetworkTransform>();
} }
public override void OnStartClient() public override void OnStartClient()
@ -105,7 +105,7 @@ namespace SanAndreasUnity.Behaviours
if (this.NetTransform != null) if (this.NetTransform != null)
{ {
this.NetTransform.syncInterval = newSyncInterval; this.NetTransform.syncInterval = newSyncInterval;
this.NetTransform.sendInterval = newSyncInterval; // one more property that we need to assign //this.NetTransform.sendInterval = newSyncInterval; // one more property that we need to assign
} }
} }