About
Welcome to Ghoscher’s blog!
My name is Hisham Ghosheh,
I didn’t create this blog to discuss my favorite color 😉 ,I made this blog so I can share knowledge and files with others!
Most topics here will be related to programming, gaming, graphics…
Comments are always welcome 😀
so what is your favorite color ? 😀
Actually it’s kind of bluish 😀
Good afternoon!
Relating to 3d object picking, I followed the official XNA picking examples and yours using rays from mouse cursor, till here everything goes right as expected, but then I came accross a little problem.
I’ll explain myself with an example:
I have a textured model lets say a keyboard. It’s divided in various meshes, all the keys are in the same mesh, and user can difference between them because of the texture, how could I get the point of the mesh the user clicked to calculate which key was pressed?
If camera were static I could work with 2D projection of the scene, but I wish to do it in 3D space as then it would work from any point of view.
Thanks in advance! 😀
The first solution that came to my mind is this:
Create a grid over the keyboard where each key occupies one or more rectangles of the grid, you can then check for intersection between the ray & a rectangle ( a 2d rectangle in a 3d world ),
the implementation might cause some headaches because of the math involved.
An alternative is a 2 dimensional array of BoundingSpheres where each sphere is located over a key.
Sorry if I couldn’t provide much help :(, but I’ve never thought about such an idea!, Please let me know when you find a better solution :).
Thanks for the idea, I’m already working on those bounding rectangles/spheres, and I’ve been busy with it, thus I forgot to answer last night. Now I need to fix problems between each model size-scale :$
I’m not so sure about how to get the point where ray collides in the surface of the mesh.
Will give you feedback when I make some progress and show you the result once it’s done 😉
Using bounding volumes is easier than using a grid, you don’t actually need to find the point of intersection, you just need to know which BoundingSphere\Box the ray intersects!
Can you please comment in the Picking tutorial instead of here 🙂
You know, this is an about page!
XNA Gui System Update Request
Would it be possible to update your xna gui system so that the user can check for individual control events for each specific control in the form as opposed to checking for the same events for all the controls in the form controls at once ? This would make xna a totally event driven system very similar to Visual Basic which I why I admire the language. I am very impressed with your gui system. I am making a custom xna engine and this was exactly what I have been looking for. Please continue updating it.
Thanks a bunch,
Brad in Houston
hmm…
I don’t fully understand the issue you’re talking about (since English isn’t my language 🙂 )
If you have a form with many controls in it, you must wire the events for each control individually, It’s okay if a control isn’t wired to any event.
If you please could explain the issue with an example & I will be glad to help.
This snippet of code was in Game1.cs
Look at the added code I put in and you will see what I am trying to do:
Thanks,
Brad
There’s a misunderstanding here,
In that example I wired all controls to the same event for simplicity, for example If I had two buttons
so when any button is clicked the function Btn_Click will be executed.
Controls events are completely independent from each other, what matters is how to wire them to functions, you can use one function for all the events, or you can specify a different function for each event
Now each button will call a different method when clicked.
So it’s up to you how to wire controls with events.
That answers and addresses my needs completely. I appreciate your knowledge. Hope to see more new exciting controls for your xna gui ! I would love to see a multi-line text box, a horizontal/vertical scroll bar, and a treeview control. You have helped me create my own xna custom gui animation engine with your fabulous gui program. 🙂
Thanks so much,
Brad
Thank you for the compliment :).
About the other controls : I don’t think games need such complicated controls, I wanted to keep things simple enough for a game :).
Now I have the xna gui looking and behaving exactly like custom made visual basic controls ! Awesome work dude 🙂
Hello Hisham,
I’m very interested in your sample of offline maps. But I was “caught” in a part. I coudn’t generate the tiles. I don’t know how to do this. Can you please help me?
Hi,
Simply watch the first 1.5 minutes of this video (to 1:30)
it explains how to get the map file step by step.
If you have further questions please post your comment on the tutorial page 🙂 (not the about page).
Hi i tried your app hexscreen.. I think you have not correctly implemented the. Touch ,as the area we touch should go inside rather than coming out. I think if screen width is 10 and i touch at 5,2 you need to take it as 5,8
Hi, I don’t think there’s a “correct” way to do this 🙂 , I wanted the screen to be attracted to the user’s touch location.
If you want to continue this discussion then kindly take it to the Hexscreen post:
https://ghoshehsoft.wordpress.com/2013/09/20/hexscreen-3d-live-wallapper-for-your-android/
Thanks.