I am trying to make it so that when I complete my game I will try to play the game on my Nintendo Switch, but I cannot figure out how to do the controller joystick inputs. I looked for a while, and I cannot figure it out, can I have some help on how to do it
my game is a 3D first person game, so I need the right joystick to rotate the camera, and the left joystick to move the player, I already have the other things set up
I followed what it says and messed around with it and nothing worked, I tried things like:
This.app.gamepad.getAxis()
This.app.gamepad.axis.getAxis()
This.app.gamepad.getAxis(PAD_L_STICK_X)
I think the above may offer some answers. If you have a computer that you are developing on is it possible that you also have a gamepad type controller for your PC. If so do you get the same reaction?
I don’t even have the ability to code it to be joystick-compatible yet, I am trying to figure that out right now, I know how I can upload my game to the switch, but if I did right now, I would be unable to move
@Linkplayer I admire your excitement about running a Playcanvas game on the switch. Let me try to explain some of the aspects that you are working with. Playcanvas is a really great platform for game development. It is however based on web browser usage. What makes this great is that you can develop a game on your PC and share it with a large user base since technically any device that has a full browser interface whether it is a cell phone, tablet, PC, Mac, etc it will run. There is however a way the you can make your game stand alone by using Electron. Electron emulates a browser on a device so it will act as stand alone.
The Nintendo Switch is somewhat of a closed system. You must sign a NDA with Nintendo International and supply a description of the game you plan on designing for their approval. There is a special SDK which includes a version of Unity that enables developers to download and debug directly on the Switch. The Switch itself uses a special file format that was developed by Nintendo. To the best of my knowledge you can not download a file directly to the switch and have it run your application.
Please see this link for more information. This is the process I am currently going through and awaiting Nintendo Internationals response.
I follow @Leonidas suggestion first by using the Gamepad Tester. Also, this Playcanvas game has some history but will give you a test game for testing gamepads. You can fork it and try out a gamepad of your choice on a PC or Mac or Chrome device that supports either a Bluetooth or wired controller. Using the tester program to make sure your device is recognized.
I basically already know that. I know someone who knows how to transfer the code to be switch compatible, but the switch can also get games from microSD cards, which you can put into the console, but my biggest question still remains, how do you code the usage of joysticks, or anything with gamepads in general, I cannot figure any of them out.
@Linkplayer Do you have a PC or a development environment that you can test the gamepad controllers? If so have you tried the project link provided above? One way to get to know your switch controller is to Bluetooth connect the controller to a PC/Mac/Maybe Chrome device and use the above test program as pointed out by @Leonidas.
If you have a project that you can share the link of with the forum that would be great for all of us to help. It would be very helpful to know why a gamepad is not working formulate an answer. It’s very hard to understand why it isn’t working without debugging it a bit.
As for the Switch download and execution, the statement above covers the extent of my knowledge. Sounds like you have the execution of a browser based system covered.
I copied this from another post.
I’m running from memory here:
In the project settings in the editor, there should be a tickbox called ‘use gamepads’ or similar. This will initialise the gamepad code at startup.
You can then access the connected gamepads from this.app.gamepads from any pc.script.
As I read you response closer I also see the following error
This.app.gamepad.getAxis()
This.app.gamepad.axis.getAxis()
This.app.gamepad.getAxis(PAD_L_STICK_X)
This …>>>>>> should be this.app.gamepad lower case on this