Joystick moves the character same as WASD but is interferring with the look function.
Look function is stock from the template.
Joystick has +1 -1 ranges. I need soft ranges on the four directions so the character can move slowly on small movements and gradually speed up the further the joystick is pushed.
For wsad you should use the Input.get_vector(left, right, up down) #actions. This will give you a vector. You can then also make a vector with the joypad axises (input.get_vector(Axis left, axis right,axis up, axis down) #axtions with +/- direction and deadzones) . Then just multiply move direction vector with your movement speed. Wasd will still be hard and axis will be smooth. Bothe will be -1 to 1.
Better yet just give your actions a physical button and an axis half. Then you only need one set of code logic.
I am trying to drop WASD completely and create an analog controller only for gamepad or mobile virtual joystick.
Was hoping there was an easier way to rework the simple fps controller demo only for analog gamepad or virtualjoystick. The player movement in the final demo will be analog, meaning the player can move from very slow to full run depending on the position of the gamepad joystick.
Any code snippets will really help. I come from C and javascript, but I don’t know gdscript.
Update
Got two joysticks working. See Dropbox link to full working code.
A few issues.
How to disable touch on the screen interferring with the joysticks.
Temporarily disabled left strafe and right strafe on the left joystick. Movement is very jerky based on a +1 or - 1 value. Check Player.gd for details.
How do I get the movement to be analog for the left joystick?
The right joystick needs to recenter so that a player does not have to take his finger off the joystick to adjust his view. Currently you can only look so far until you have to swipe similar like a mouse.
Once this template is done, I will post it for free on the Godot Asset Library. I welcome any contributors who can help smooth out the code for full analog support.
I assume mouse track pad issue acting like axis? There is an ongoing GitHub issue on that. To resolve just set axis action device to a non-zero number. This will be hard to set for the actual controller. You may need to develop a controller UI interface.
Input get vector movement by applying a base speed multiplied by input vector to position or apply forces to physics body. as I have stated before, also potentially deadzones in the way?
Making input actions for the left axis.
Input get vector movement that continuously rotates character or camera by applying a rotation speed multiplied by the input vector.
Do you have a GitHub/bitbucket/gitlab? Contributors can make pull requests and you can decide if you like the changes or not.
Since the current asset library is on GitHub you can fork it and we can contribute the improvements.
Using the “ui_up/down/left/right” is bad practice in my opinion it requires custom actions in the input map.
But they probably did it that way because they didn’t know how to add actions through the asset.
Full Analog FPS Camera
(virtual joystick on mobile)
based on
Simple FPS Camera
and
VirtualJoystick
on
Godot Asset Library
Hi Guys
This is my first project on Godot, re-coding a template on an android device (smartphone) with Godot 3.5 stable APK.
Considerations, Breakdown and feedback on editing from an Android device (smartphone)
Full analog has been implemented and works better than expected based on above projects from GAL.
Virtual joystick script needed a second one to isolate Left and Right joysticks. Pulling values from one script caused issues. Each virtual joystick now has its own script, own scene and own class.
VirtualJoystickLeft
VirtualJoystickRight
Agnostic and Proper naming convention had been coded into each script.
Now reserved input actions won’t be interferred with (ui_left, ui_right, ui_up, ui_down). Still requires editing the Input Actions in Project Settings by hand, and then binding to correct axis (small shlep and doc’s are hard to find). If anyone can contrib a gdscript for 3.5 to automate these input actions into Project Settings, send a PM or reply to this thread with an upload.
Created a global.gd script to pass variables between the two virtual joystick scripts and the player.gd script to get full analog values. Pretty cool to watch the players shadow walk slowly ingame. See demo attached.
Default “touch to look” still interferes with left joystick (move). Left joystick is affecting look. Would like to leave default “touch look” as an option, so don’t wish to disable it yet. Maybe toggle. Suggestions?
Tried making a RECT under the left joystick (move) to isolate it from “touch look”. Didn’t work.
To use this demo in a sane way, always look first before moving. Meaning, touch the right virtual joystick to look first, then touch the left virtual joystick. After that, as long as you keep the touch on the left virtual joystick, you can take your finger on and off the look function (or right virtual joystick), and then “touch look swipe” similar to mouse swiping. Will try to solve this.
Editing: on Android I am using a wireless mouse to speed up things. Problem is the keyboard pops up on every single edit operation when working on a GD script. Would prefer the keyboard to have a toggle button in the editor so I can do copy/paste operations without the keyboard popping up every single mouse click. Would be very useful to keep the keyboard out the way until it is needed.
Run. Would really love to see “run” in current editor window. I get loads of crashes with failed runs. Then gotta reload from the Project Selection screen.
Lack of editor persistence. On Android I tab between VLC and Godot a lot. Watch a lot of tuts. If I leave the editor for too long, when I come back, the editor goes back to the project selection screen. Then I have to reload the project again.
Import a new project. Would find it far more useful to have a second option during import of a new project. Currently the editor gives “Import and Edit”. Adding a second option, simple “Import Only” gives a bit of flex when I am near WiFi, just to populate a couple of projects. Then later I can choose to edit when away from WiFi.
Project selection screen. Needs a “favourite” or a “hot” section at the top. My main project needs to sit at the top of the project selection screen. The other projects I use are for test cases, so I kinda want to forget them. If I could tag a project with a star and then it sits at the top of the screen, that would be super cool. If I could give my hero project up to five stars, Then my secondary projects can be sorted based on priority from 1 star to 5 stars. The stars will also reflect how close the project is to release. 5 stars… ready for distro. Woohoo!
GLES what!! For now I am targetting GLES2 in Godot 3.5. I don’t know anything about GLES2 except that it runs well on most mobiles. Would be useful to see not only Godot version numbers on GAL projects(assets) but also a tag for GLES2/GLES3/VULKAN/etc stats so I can ignore the graphics projects that will break GLES2.
YouTube. Humble request for YouTube posters to include the Godot version you are using, and put it in the title of your YouTube tutorial. Many tuts on YouTube did not work, figured out it was not compatible with 3.5. Wasted time and effort.
Editor: Joysticks with sensitivity slider. 3.5 has no joysticks in the editor. Tried 4.x briefly and the virtual joystick were very useful. Adding a sensitivity slider as well ( x1, x2, x3,) etc can speed up moving around the editor window. In 4.x the in-editor joysticks are way too slow.
Virtual Joysticks are currently too small in the demo. My fingers are all grown up, so still experimenting to find a easy way to resize the virtual joysticks. If this could be set by the player, then big-finger dudes can also play.
Editing on an android smartphone is doable, but really needs a Bluetooth mouse to make work a bit easier. Still having issues editing heightmaps on Android/Godot. Tried Zylann and a few others, but no luck so far. Really would be cool to paint heightmaps on a smartphone for GLES2. Suggestions?
Market: GLES2 gives widest adoption, on a variety of older and never smartphones. The final game won’t be very big, but it must run on almost any mobile device.
Contributors are welcome to send feedback. If you value the suggestions, feel free to implement what will work for Godot. If you give credit, just use my handle “GreyRock”.
Really hoping I can carry a 3d editor/engine in my pocket without a freakin’ laptop.
Thanks to Godot and Fans for your hard work. Hoping you can make the editor easier for content creators who suck at coding. Will post a concept GUI in a new thread when time permits, to give an idea of what a content creator might like to see. Maybe some brave dev will take up the concept and create a miracle. More on that later.