From 1ad9da8217990a3a5b588952ed8c9b89989ad627 Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Mon, 27 Apr 2020 17:40:55 -0700 Subject: [PATCH] Fix for grab sync. Fixes #538 --- packages/sdk/src/internal/adapters/multipeer/rules.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/sdk/src/internal/adapters/multipeer/rules.ts b/packages/sdk/src/internal/adapters/multipeer/rules.ts index e52a77a2a..fc8d6d9b3 100644 --- a/packages/sdk/src/internal/adapters/multipeer/rules.ts +++ b/packages/sdk/src/internal/adapters/multipeer/rules.ts @@ -305,7 +305,7 @@ export const Rules: { [id in Payloads.PayloadType]: Rule } = { message: Message ) => { const syncActor = session.actorSet.get(message.payload.actorId); - if (syncActor && (client.authoritative || syncActor.grabbedBy === client.id)) { + if (syncActor && ((client.authoritative && !syncActor.grabbedBy) || (syncActor.grabbedBy === client.id))) { const correctionPayload = message.payload; // Synthesize an actor update message and add in the transform from the correction payload. @@ -399,7 +399,7 @@ export const Rules: { [id in Payloads.PayloadType]: Rule } = { message: Message ) => { const syncActor = session.actorSet.get(message.payload.actor.id); - if (syncActor && (client.authoritative || syncActor.grabbedBy === client.id)) { + if (syncActor && ((client.authoritative && !syncActor.grabbedBy) || (syncActor.grabbedBy === client.id))) { // Merge the update into the existing actor. session.cacheActorUpdateMessage(message);