Answer the question
In order to leave comments, you need to log in
Is physics handled correctly on the server?
I use phaser+nodejs+socketio+matterjs.
I run the following code on the server:
t=setInterval(function(){
Matter.Engine.update(engine, engine.timing.delta);
},1000/60)
socket.on("getBlock",function(){
socket.emit("sendBlock",boxA.position)// положение какого-то блока.
});
//phaser
function create(){
player = this.add.sprite(300,100, 'circle');
socket.on("sendBlock",function(blockPos){
player.x=blockPos.x;
player.y=blockPos.y;
});
}
function update(){
socket.emit("getBlock");
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question