I wanted to see how to deal with multiple fingers in touch controls, so I poked around and made a video about my findings. For any ideas and improvements, leave a comment!
This was way too long in the making. This weird 'life' thing kept interrupting me. Anyhow, I somehow got past 1k subs now. 🤔🥳 Thanks for watching! For any ideas, questions, improvements, etc. - leave a comment ;)
@abdiel3358
2 жыл бұрын
Do you how to change languages in a game? Like, having all the texts in a database and then switching between languages
@iaknihs
2 жыл бұрын
@@abdiel3358 Text-translations will usually be handled using spreadsheets (specifically, comma-separated-value files [.csv]) You have a column for keys, and then one column each per language. Then you can import this .csv into godot (project settings > localization) allowing you to access them in code. For more details, you can also take a look at the "importing translations" and "internationalizing games" in the Godot docs.
@Pulkz
Жыл бұрын
Love ur Tutorials mate
@kathe5664
2 жыл бұрын
Thanks for the new wonderful tutorial video 💜
@iaknihs
2 жыл бұрын
Very welcome, glad you liked it!
@baus96
10 ай бұрын
That's what I needed, Thank you so much :)
@adammekla5465
2 ай бұрын
Thank you. That was very helpful.
@gofastutos
2 жыл бұрын
Continue making Godot known with your videos 👍
@boxerliso4855
7 күн бұрын
Gracias, hermano!! Estoy haciendo un juego en mi celular y por fin pude saber cómo hacerlo. 😺
@question_mark
Жыл бұрын
lezgoooo
@redsam4538
2 жыл бұрын
Big thanks! I'm working on a project that needs touch inputs. I've just figured how to solve my problem while I was watching this vid. Idk if its a bug, but the first multitouch example doesn't work if you handle it from a control' gui_input signal; because it doesn't detect touch release when there is multiple fingers.
@iaknihs
2 жыл бұрын
Hey, have you tested different cases for that issue? Does it only miss the release signal after moving fingers, or always? Sounds to me like either the signal isn't made to account for multitouch (so gotta manually keep track of fingers like in the video), or it only fires if a finger is released on the same gui element. Can't test right now, but seems like a interesting thing to try.
@redsam4538
2 жыл бұрын
@@iaknihs the exact piece of code that you showed on the video works in the _input method but doesn't in a gui_input callback. A release input is only fired when all fingers are up. Must be a bug, we should open an issue if its the case
@redsam4538
2 жыл бұрын
@@iaknihs after retesting, it fires a release only when the first finger is up, whether it has moved or not
@iaknihs
2 жыл бұрын
@@redsam4538 fascinating, yeah I don't see this mentioned in the documentation at all so seems like a bug indeed. Which version are you using?
@redsam4538
2 жыл бұрын
@@iaknihs v3.4.2
@lordav5520
4 ай бұрын
I have a question. Do you can made joystick with a character 2d with a grid o with a 32x32 pixels ? Thank you
@PHDtt
3 ай бұрын
is it possible to make a tutorial for 3D scene ?
@capuchinosofia4771
2 ай бұрын
the code is in a pretty small font and is hard to read what you wrote down but besides that, very good tutorial!
@capuchinosofia4771
2 ай бұрын
for future hard-sighted people: This is the first part code: extends Node2D var down =[] func _input(event): if event is InputEventScreenTouch: if !event.pressed: down.erase(event.index) elif is_in_rect(event.position, $CanvasLayer/TextureButton.get_rect()): down.append(event.index) $CanvasLayer/Label.text= str(len(down)) func is_in_rect(pos, rect): return pos.x > rect.position.x \ and pos.y > rect.position.y \ and pos.x < rect.end.x \ and pos.y < rect.end.y \
@capuchinosofia4771
2 ай бұрын
well, after some trial and error I have to give up on the second part of the tutorial (camera zoom by pinch). Maybe its my godot version? Im using 3.5.2. I used tons of print statements and it seems that only pos 0 is registered while pos 1 is nowhere to be found (not even the "everything is false for pos 1" print is printed. Any idea why? Code: extends Node2D const zoom_speed = 0.005 const zoom_min = 0.25 const zoom_max = 4.0 var pos_0 : Vector2 = Vector2.ZERO var pos_1 : Vector2 = Vector2.ZERO var pos_0_valid: bool = false var pos_1_valid: bool = false var pos_0_moved: bool = false var pos_1_moved: bool = false var distance_prev = 0 var distance_prev_valid = false func _input(event): if event is InputEventScreenTouch: if event.pressed: match event.index: 0: pos_0 = event.position pos_0_valid = true print("pos0 is valid") pos_0_moved = false 1: pos_1 = event.position pos_1_valid = true print("pos1 is valid") pos_1_moved = false else: #set position as invalid match event.index: 0: pos_0 = Vector2.ZERO pos_0_valid = false pos_0_moved = false distance_prev_valid = false print("everything is false for 0") 1: pos_1 = Vector2.ZERO pos_1_valid = false pos_1_moved = false distance_prev_valid = false print("everything is false for 1") elif event is InputEventScreenDrag: match event.index: 0: pos_0 = event.position pos_0_moved = true print("pos0 is moved") 1: pos_1 = event.position pos_1_moved = true print("pos1 is moved") func _process(_delta): #pinch/zoom if pos_0_valid and pos_1_valid and (pos_0_moved or pos_1_moved): print ("zoom conditions have been met") var distance: float = pos_0.distance_to(pos_1) if !distance_prev_valid: distance_prev = distance distance_prev_valid = true else: print("camera should be adjusting") #adjust camera zoom value var dist_change = distance - distance_prev $Camera2D.zoom.x = clamp($Camera2D.zoom.x - dist_change * zoom_speed, zoom_min, zoom_max) $Camera2D.zoom.y = $Camera2D.zoom.x distance_prev = distance
@digitalpotato4867
Жыл бұрын
The touch funcions for Android, do you think would export for Linux x64? I have a phone and Tablet, and I'm not quite sure that the touch functions might not be usable if godot exports for Linux desktop
@iaknihs
Жыл бұрын
That's a tough one, I don't have any touch devices I could run Linux on so I can't actually test it. Theoretically the engine *should* recognize touch inputs from all platforms where export templates exist, but there are always edge cases where it's going to fail so if you find it doesn't work it's probably best to report as a bug to the godot devs
@digitalpotato4867
Жыл бұрын
@@iaknihs if it works under html5 or webgl in your phone, you're ready to export to Linux with the pck is enough. I can do the rest of the me magic
@level8208
Жыл бұрын
Hello! How to adapt this to drag to separate objects? Like one finger for 1 apple
@iaknihs
Жыл бұрын
When clicked, the object would have to save the index of which finger clicked it. Then while sliding it can move to whichever position that index has now. When the finger is lifted, the object can forget the id again
@Ocape
Жыл бұрын
How can i make gun (look at) with mobile control like if i touch the screen the gun look at where i touched please i need to know
@iaknihs
Жыл бұрын
Do you mean a 2D game or 3D? In 2D it's easy, just get the touch coordinates and rotate the gun towards that. (can find the math for it on google pretty quick) In 3D you need to first determine what you actually touched. So a raycast from the touch position at the camera to whatever object would be "straight ahead" from there. That's a fair bit more complex o=
@intrusivethoughts3601
Жыл бұрын
@@iaknihs how? been struggling to find the mobile aim 2D for days(weeks now), I need to calculate joystick pos and rot somehow
Пікірлер: 31