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

Commit

Permalink
PR fixes (#598)
Browse files Browse the repository at this point in the history
  • Loading branch information
nik0la31 authored May 25, 2020
1 parent 4b72572 commit e63426e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
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

0 comments on commit e63426e

Please sign in to comment.