This is a much cleaner way of detecting a mouse click than the other method I googled that explained how to make a ray cast from the camera. Thanks!
@nvm91746 ай бұрын
its insane how the new videos and tutorials are useless,need raycasts and adding some other nodes-classes,connecting them etc.While its this much easy...thank you man saved my hours
@budigtoon4185 жыл бұрын
I have seen some of your tutorials, and I think you have good knowledge and skills. I hope you are diligently uploading about the Godot 3D tutorial for the Godot community. thank you!
@Crisisdarkness5 жыл бұрын
Wow this is awesome, all the videos that you created are so useful, I'm sure your channel will have a large audience, thanks estimated Dave
@OpsFox2453 жыл бұрын
This is great just what I was looking for.
@anicepineapple90672 жыл бұрын
Followed the video and nothing happened. Is this broken in 3.5
@BenColemanUK3 жыл бұрын
This is fantastic, very simple, but it seems to allow me to click on objects which are hidden behind other objects in the scene, I don't know if I've missed a step but how do I stop hidden objects being clickable?
@gyattrizzV Жыл бұрын
I have input ray pickable on and I cant make the on input event work at all
@Obsidian-Tux4 жыл бұрын
Thanks, this helped me a lot :)
@Hajdew5 жыл бұрын
Great video! But why there are 2 mouse cursons at 1:09?
@DavetheDev5 жыл бұрын
lol nice eyes. Sometimes when I'm editing the videos, there is too much to say and not enough video, so I take a screenshot of the video to pause it while explaining something. During the screenshot, sometimes my mouse gets in the way. So, there is the mouse on the video and the mouse when I take a screenshot. Now that someone has noticed, I'll either find a better way to pause the video, or.....just have everyone play Where's Waldo with mouse cursors....hahhaah
@Hajdew5 жыл бұрын
@@DavetheDev i know in sony vegas is a screen shot option but idk which software do you use.Also im a big fan of yours intro's
@DavetheDev5 жыл бұрын
@@Hajdew I use Blender for video editing. I learned if you press F12, blender will render the current frame as an image that can be imported back into the video editor. Thanks to you, I learned something new. :) As for the intro, I used to do a lot of programming on the TI-83+ calculator when I was a kid, so what you're seeing is a TI program running on an emulator, glad you like it.
@moric46775 жыл бұрын
that's illuminati
@iamlordstarbuilder55952 жыл бұрын
Any idea how to detect whether it is clicking away? Would be nice to deselect something in the same way I selected it.
@DavetheDev2 жыл бұрын
Can do. When you select something add it to a list of selected things. When you click again anywhere on the screen, iterate through the list of selected things, deselect them and remove them from the list before checking if something new was selected.
@iamlordstarbuilder55952 жыл бұрын
@@DavetheDev I actually went with something different, I added a boolean that the selected object flips when clicked and then the next frame is flipped back off, only way to turn it on again is to select an object. Your solution works for multiple objects ig, but I’m only selecting one at a time in my game
@DavetheDev2 жыл бұрын
@@iamlordstarbuilder5595 Sweet!
@black_forest_10 ай бұрын
Nothing happened, is it different in Godot 4? I assume so since for example the ray bool was already enabled
@DavetheDev10 ай бұрын
Yes, it was made for Godot 3. Thanks for the feedback. I've changed the title of the video to reflect that it only works in Godot3.
@flyingjudgement Жыл бұрын
Hi, is any one know how to call this type of functions from C#?
@justOne503 Жыл бұрын
using Godot; using System; public class YourClassName : Node3D { public override void _Input(InputEvent @event) { if (@event is InputEventMouseButton mouseButtonEvent) { if (mouseButtonEvent.ButtonIndex == (int)ButtonList.Left && mouseButtonEvent.Pressed) { GD.Print("Pressed Left Mouse Button"); } } } } Try this.
@Retales4 ай бұрын
I had already started working on something way more complicated and beyond my skill level, because I thought I could maybe handle it. Luckily I googled a bit more and found this
@leonseghesso3539 Жыл бұрын
Funciona para juegos en Android?
@miguelsarmiento92684 жыл бұрын
click in 3d very good only you explain this thanks for the help
@aleksandersanya18172 жыл бұрын
Very helpful! Thanks.
@Galaxy-pm2ff4 жыл бұрын
sorry, how do I make the button with mouse mode captured on? nice tutorial by the way
@logangraham29564 жыл бұрын
i am having a bit of an issue clicking these area nodes through my players hud , if i turn off my huds visibility i can click the area nodes but if the hud is visible then i am not able to click the area nodes. how do i get my clicks to go through my hud? its a control node
@DavetheDev4 жыл бұрын
In the Inspector, Control derived nodes have a "Mouse" menu. Under that menu there is a "filter" drop down with the options, "Stop, Pass, Ignore". Try changing those filter options.
@logangraham29564 жыл бұрын
@@DavetheDev i actually tried that setting once and thought it was useless XD i set it to pass and it did nothing. i tried ignore this time and it worked. that so weird , I'd think that "pass" = "pass-through".
@DavetheDev4 жыл бұрын
@@logangraham2956 Yeah, it can be a bit misleading. Glad you got it to work. The "pass" option actually captures mouse input, but if the control node that was clicked doesn't handle the input it will Pass the event along to a parent control node, if there is one. At least that's what the documentations says...
@logangraham29564 жыл бұрын
@@DavetheDev my next challenge is getting proper camera rotation and then maybe figuring out procedural generation for infinite ground my current solution is to exported a vector3 which i set to equal my velocity and then i just move the ground on the x+z so it always stays under the player. its a temp fix but it'll hold till i figure out how to generate ground from code instead of manually placing every single block.
@hoppalapasam533 жыл бұрын
thank you so much, this is realy help me out. but i did use it with touch screen input touch. its work that way as well.
@kishonoi1913 жыл бұрын
what about with a crosshair?
@kedalovo4 жыл бұрын
Sorry to ask something that might be unrelated, but I don't know how to solve this: I have a 2d scene, which has a Viewport in it to show a 3d object in this scene. Now, if I understand correctly, there is no way to actually make that object clickable using Viewport, because, basically, I use the Viewport to get texture from this object. Maybe there is actually a way to make the texture clickable, but I don't know about it. Do you mind sharing the solution if there is one?
@DavetheDev4 жыл бұрын
Off the top of my head, use a TextureRec to display the texture from the Viewport. When you click the TextureRec, you'll get an InputEvent for via the "gui_event" signal. Take that event and manually translate it into a new event that will be picked up by the 3D Area node of your 3D object. You can fire fake events down the node tree by via the SceneTree. So, in psudocode it would be this... 1. Capture the click event postion on the TextureRec. 2. Translate the click position from the TextureRec coords into the 3D camera's screen-space coords. 3. Make a new instance of an InputEvent and put the screen-space coords in its properties. 4. Fire the custom "fake" InputEvent down the NodeTree via the SceneTree. 5. Pickup the InputEvent in the 3D object's Area node like normal via it's InputEvent signals as shown in the video. I haven't done it myself, but I'd be curious to learn how it goes...
@kedalovo4 жыл бұрын
@@DavetheDev Thank you very much for the answer! I will try this some time soon and return in any case (success/failure). Just started learning Godot like 2 days ago, so this is unbelievably helpful
@kedalovo4 жыл бұрын
@@DavetheDev OK, I got stuck on the second step (a bit further than I thought). I successfully understood how to get the position of click, but have no idea how to get these coordinates go to function inside my 3D scene. Tried to call that function from the main scene inserting click_position, but got so many mistakes that I don't think I am doing anything correctly. Sorry for taking your time, but if you could spare some, would you mind explaining it a bit more down-to-earth?
@DavetheDev4 жыл бұрын
@@kedalovo Explaining is a bit complicated, but it's an interesting problem, so I made an example demo instead. Download and Setup this Godot project: github.com/EXPWorlds/Godot-Tutorials Under the "8 Clicking 3D Objects" folder is a Supplementary folder and another folder with your youtube user name. Load the "Demo" scene and run it with F6. Hope that helps better than my rambling explanations. ^_^ Let me know how things go.
@kedalovo4 жыл бұрын
@@DavetheDev Thank you very much, I'm amazed by the fact you are still willing to help me. I hope that what you have already given is enough to figure things out by myself.
@mikorsky_s.9226 күн бұрын
Yo thanks man!
@gd76814 жыл бұрын
Thanks for the tutorial. What is the purpose of creating the Sphere Spatial node instead of just creating the Sphere meshinstance directly?
@DavetheDev4 жыл бұрын
Good question. You can use the MeshInstance directly if you want. By habit I create things using a principle called "Separation of concerns" en.wikipedia.org/wiki/Separation_of_concerns In which each object has a specific job. In this case, the Spatial Node's job is to encapsulate an "entity" in the game world, and the job of the MeshInstance is only to display what the entity looks like. In simple examples like this, it doesn't much matter, but as things get more complex, Separation of Concerns becomes really important. I didn't really think about all that when I made this though, like I said, it was mostly because of habit.
@joaofaleiro82974 жыл бұрын
Thank you so much dude
@kohrakvaza4 жыл бұрын
Thanks for the tutorial. Trying the demo, it seems like the spheres all change color when clicking one of them, instead of changing individually.
@DavetheDev4 жыл бұрын
That's because all three of your spheres probably share the same material. Right click on the material and select "Make Unique". When you duplicate things in Godot, the duplicates share any sub-resources like textures, shaders, materials, curves, etc. unless told not to.
@xardinlume73456 ай бұрын
Damn. Thanks.
@ivanaksmsk3 жыл бұрын
Thank you!
@LoneWandererNV8 ай бұрын
Thank you
@biankro Жыл бұрын
Thank you :D
@mirohorvath5 жыл бұрын
thank you
@simpson670010 ай бұрын
strange that this signal wouldn't include a reference to the node that was just clicked on. i have the Area3D send a signal to my camera and i want to detect which object i last clicked on to make the camera orbit around that object.
@OcaSpacca5 ай бұрын
That's what I'm trying to do as well, did you find any solution to get the node just clicked?
@OcaSpacca5 ай бұрын
nvm, just found a solution, the argument "shape_idx" return the index of the collision shape of the area, but since there's only one collision shape, it will always return 0. So the best thing to do is to use a single Area3D and adding all the CollisionShape3D as children, as many as you want; this also mean that the Mesh must be child of the CollisionShape