File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed
Server/Components/NPCs/Playback Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -101,11 +101,31 @@ bool NPCPlayback::process(NPC& npc, TimePoint now)
101101 {
102102 if (recordData_.playbackType == NPCPlaybackType::Driver)
103103 {
104- npc.resetKeys ();
104+ if (currentIndex_ < recordData_.vehicleData .size ())
105+ {
106+ const auto & syncData = recordData_.vehicleData [currentIndex_];
107+
108+ npc.resetKeys ();
109+ npc.setVelocity ({ 0 .0f , 0 .0f , 0 .0f }, false );
110+ npc.setPosition (syncData.Position , false );
111+ npc.setRotation (syncData.Rotation , false );
112+
113+ npc.sendDriverSync ();
114+ }
105115 }
106116 else if (recordData_.playbackType == NPCPlaybackType::OnFoot)
107117 {
108- npc.resetKeys ();
118+ if (currentIndex_ < recordData_.onFootData .size ())
119+ {
120+ const auto & syncData = recordData_.onFootData [currentIndex_];
121+ npc.resetKeys ();
122+ npc.setVelocity ({ 0 .0f , 0 .0f , 0 .0f }, false );
123+ npc.setPosition (syncData.Position , false );
124+ npc.setRotation (syncData.Rotation , false );
125+ npc.resetAnimation ();
126+
127+ npc.sendFootSync ();
128+ }
109129 }
110130 startTime_ = now - recordData_.timeStamps [currentIndex_];
111131 return true ;
You can’t perform that action at this time.
0 commit comments