Closed ziarmandhost closed 1 year ago
Hello, @schteppe !
I have multiplayer game and running p2.js from server using nodejs module: v0.7.1. I have 2 entities: player and wall. Also I have this setup:
export const COLLISION_GROUPS = { PLAYER: Math.pow(2, 1), SOLIDBLOCK: Math.pow(2, 2), SPRING: Math.pow(2, 3) }
this.body = new p2.Body({ type: p2.Body.DYNAMIC, mass: PLAYER.weight, position: [0, 0], fixedRotation: true, collisionGroup: COLLISION_GROUPS.PLAYER, collisionMask: COLLISION_GROUPS.SOLIDBLOCK | COLLISION_GROUPS.SPRING }); this.body.addShape(new p2.Box({ width: 160, height: 249, material: MATERIALS.PLAYER }));
this.body = new p2.Body({ type: p2.Body.STATIC, // mass: 1, position: [x, y], // fixedRotation: true, collisionGroup: COLLISION_GROUPS.SOLIDBLOCK, collisionMask: COLLISION_GROUPS.PLAYER, }); this.body.addShape(new p2.Box({ width, height, material: MATERIALS.SOLIDBLOCK }));
Player passthough walls. I sending positions to client and it just rendering it.
Problem was with how I add object to world. Typo in name of property of class that contain world.
Hello, @schteppe !
I have multiplayer game and running p2.js from server using nodejs module: v0.7.1. I have 2 entities: player and wall. Also I have this setup:
Player
Wall
Problem
Player passthough walls. I sending positions to client and it just rendering it.