Looking and shooting with controller

Hi I’m working on adding controller input to my game I can walk around and jump but i can’t shoot or look around. I was wondering if i can have the controller control the mouse or if i just need to find another method.

Thanks for your time
Sincerely-
William Boersma.

You need another method. The browser can’t control the position of the mouse.

ok if i send you the code could you see how i could change it so i can take controller input as well?

I’m afraid I don’t have the free time to do one to one consulting for this.

ok

just pointerlock your mouse then use the controller input

Hi @jus.co_ding_me_23 I got the looking part i just need to get shooting all i need is the x and y values for the center of the screen.
do you know what that is?

https://playcanvas.com/editor/code/749856?tabs=40420369

@yaustar Do you know what the x and y values for the center of the screen are?

@WilliamBoersma31 screen.width/2 and screen.height/2

thanks

it didn’t work can you take a look at my to see what i did wrong https://playcanvas.com/editor/code/749856?tabs=40420369

//var et = 2;
 //var er = 2;
  if (this.app.gamepads.wasPressed(pc.PAD_1, pc.PAD_R_SHOULDER_2)) {
      this.doRaycast(screen.width/2, screen.height/2);
  }  
1 Like