Skip to content
This repository has been archived by the owner on Jun 10, 2022. It is now read-only.

PR fixes #598

Merged
merged 1 commit into from
May 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions packages/sdk/src/actor/physics/physicsBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,10 @@
*/

import { Guid } from "../../util";
import { TransformLike } from "../transform";

export interface PhysicsBridgeTransformInfo {
id: Guid;
motionType: number;
transform: Partial<TransformLike>;
}

export interface PhysicsBridgeTransformUpdate {
export type PhysicsBridgeTransformUpdate = {
id: Guid;
time: number;
transformCount: number;
transforms: string;
transformsBlob: string;
}
3 changes: 1 addition & 2 deletions packages/sdk/src/core/contextInternal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -406,8 +406,7 @@ export class ContextInternal {
}

public updatePhysicsBridgeTransforms(transforms: Partial<PhysicsBridgeTransformUpdate>) {
if (!transforms)
return;
if (!transforms) { return; }
this.context.emitter.emit('physicsbridge-transforms-update', transforms);
}

Expand Down
6 changes: 3 additions & 3 deletions packages/sdk/src/internal/adapters/multipeer/rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ export const Rules: { [id in Payloads.PayloadType]: Rule } = {

return message;
},
shouldSendToUser: (message: Message<Payloads.ActorUpdate>, userId, session, client) => {
shouldSendToUser: (message: Message<Payloads.PhysicsBridgeUpdate>, userId, session, client) => {

return true;
}
Expand All @@ -805,15 +805,15 @@ export const Rules: { [id in Payloads.PayloadType]: Rule } = {
...DefaultRule.session,
beforeReceiveFromApp: (
session: Session,
message: Message<Payloads.ActorUpdate>
message: Message<Payloads.PhysicsBridgeUpdate>
) => {

return message;
},
beforeReceiveFromClient: (
session: Session,
client: Client,
message: Message<Payloads.ActorUpdate>
message: Message<Payloads.PhysicsBridgeUpdate>
) => {

session.sendPayloadToClients(message.payload, (value) => value.id !== client.id);
Expand Down