Position of allies in POV demos #304
-
I try to get the position of every player at each tick of a POV demo. My Position and the position of the opponents is changing, but the position of my allies stays the same.
This is the code displays:
As you can see the position of the ally has not changed after 10000 ticks and for the other allies it is the same. Is there a way to get the right position of the players? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi @julian1198 - please can you attach the demo file if possible? I imagine the reason why the position isn't updated is because the allies in question are outside of the PVS (and so aren't networked to the recording player). You can check this with demoFile.on('tickend', e =>{
if(e % 10000 !== 0) return;
demoFile.players.forEach(element => {
console.log(element.name);
if (element.isDormant)
console.log('> dormant');
else
console.log(element.position);
});
}); |
Beta Was this translation helpful? Give feedback.
-
This was a bug - apologies for taking so long to fix this. Your code should now work - I've just released v2.7.0 with the fix. I've updated your code below to use the const spottedEntities = new Map<number, Vector>();
demoFile.userMessages.on("ProcessSpottedEntityUpdate", e => {
if (e.newUpdate) spottedEntities.clear();
for (const update of e.entityUpdates) {
spottedEntities.set(update.entityIdx, {
x: update.originX * 4,
y: update.originY * 4,
z: update.originZ * 4
});
}
});
demoFile.on("tickend", tick => {
if (tick % 10000 !== 0) return;
console.log("Tick", tick);
demoFile.players.forEach(entity => {
console.log(
entity.clientSlot,
"",
entity.name,
entity.isDormant ? "💤" : "",
entity.isRecordingDemo ? "📹" : ""
);
if (entity.isDormant) {
const pos = spottedEntities.get(entity.index);
console.log(" approx", pos ? JSON.stringify(pos) : "<not spotted>");
} else {
console.log(" ", JSON.stringify(entity.position));
}
});
console.log(`\n---\n`);
}); |
Beta Was this translation helpful? Give feedback.
This was a bug - apologies for taking so long to fix this. Your code should now work - I've just released v2.7.0 with the fix.
I've updated your code below to use the
ProcessSpottedEntityUpdate
user message. This allows you to get the position of enemies that have been spotted, but are outside of the recording player's PVS.