0

I am trying to make a multiplayer game in which the user will be playing the game in desktop screen and the same will be displayed in multiple screens. I have give a cursor image to display the position of the cursor in the mobile devices as well.

I am running into the problem of matching the position of cursor, there is an offset that is coming which is not displaying correctly in current screens and other screens. Any help can make my life easy.

Here is the code:

var Mouse_Pos;
Uicontainer.prototype.onMouseMove = function(event) {
  Mouse_Pos.x = event.x;
  Mouse_Pos.y = -event.y;
  Mouse_Pos.z = 0;
  this.Cursor.setLocalPosition(Mouse_Pos.x, Mouse_Pos.y, 0);
  //this i was exchanging with other players to match with their screen resolutions. 
  Cur_Pos_Upd = "cursorPos_" + (Mouse_Pos.x / (window.innerWidth)) + "_" + (Mouse_Pos.y / (window.innerHeight));
};

Thanks in advance.

Mark Schultheiss
  • 32,614
  • 12
  • 69
  • 100
  • Please add the HTML and any CSS and JavaScript that you have tried here – Mark Schultheiss Jan 07 '22 at 13:37
  • Here is the code: var Mouse_Pos; Uicontainer.prototype.onMouseMove = function (event){  Mouse_Pos.x=event.x;            Mouse_Pos.y=-event.y;            Mouse_Pos.z=0;            this.Cursor.setLocalPosition(Mouse_Pos.x,Mouse_Pos.y,0);          //this i was exchanging with other players to match with their screen resolutions.        Cur_Pos_Upd="cursorPos_"+(Mouse_Pos.x/(window.innerWidth)) + "_" + (Mouse_Pos.y/(window.innerHeight)) ; }; – PracticallyDev Jan 07 '22 at 13:41
  • 3
    You should use edit rather than putting in comment... – James Jan 07 '22 at 13:42

0 Answers0