How to do click-and walk in an Iso 3D RPG
Much like in Neverwinter Nights, we want to be able to click on an area in the 3D world and have the active character walk there (or all of them). But I cannot find and/or think of how this could be done! Does anyone have a good idea? (please excuse me if I sound like a newbie as this is my first MAJOR project, the rest were just to sharpen my skills like a Bricks game) Thanks.
-----------------------------
"C++ isn''''t hard, you fool!"
Famous Last Words
-----------------------------
This is called Pathfinding, and falls under the AI banner. Look it up in Google and in the reference section here.
[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost ]
[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost ]
No, no, not the actual pathfinding, I mean...ok, I''ll simplify the question a little...
How would I go about clicking on the 3D Terrain? Like, if the character clicked on the tree it would say "You clicked on the tree!" I could implement the everything else, I just can''t think of how the cursor could interact with the 3D world. I know it''s probably very simple, but I just can''t figure it out!
-----------------------------
"C++ isn''''t hard, you fool!"
Famous Last Words
-----------------------------
How would I go about clicking on the 3D Terrain? Like, if the character clicked on the tree it would say "You clicked on the tree!" I could implement the everything else, I just can''t think of how the cursor could interact with the 3D world. I know it''s probably very simple, but I just can''t figure it out!
-----------------------------
"C++ isn''''t hard, you fool!"
Famous Last Words
-----------------------------
So you''re saying "how can I get the computer to recongnize where I''m clicking?" right?
In OpenGL, this is handled by the selection buffer. Don''t ask me about DirectX. And don''t ask me about OpenGL either because I haven''t quite learned about it yet.
Maybe someone else with some more knowledge can help with this one
In OpenGL, this is handled by the selection buffer. Don''t ask me about DirectX. And don''t ask me about OpenGL either because I haven''t quite learned about it yet.
Maybe someone else with some more knowledge can help with this one
You have to convert the mouse X,Y coordinates to tile coordinates. There are a couple tutorials in the resources section.
Ben
Ben
for the provious post, that wouldn''t work on a 3d terrain. You could either do one kind of testing, or the other. The first is you just test what height it is and what width it is and compare it to the tiles but in 3d. Its hard to explain and tanstaafl talks a little about it in the last chapter.
The other way would be to do ray tracing. If your using dx, look at the picking sample. For ogl, sorry, don''t know.
The other way would be to do ray tracing. If your using dx, look at the picking sample. For ogl, sorry, don''t know.
I believe I was reading something about it either in The Red Book or in OpenGL Game Programming. Check out those books which might have something on it. Most likely the second one. I haven''t read too much in it so I don''t know.
Well, this is just a thought...but if you are working in 3D the curser could be a 3d object. Then when the user clicks the mouse you could cach the xyz of the curser object. It sounds logical...I think
Actually the cursor is 2D, unless you do something like Black & White, where the cursor has depth on the screen.
Think of Homeworld: Cataclysm where the cursor is just like it is in Starcraft. The question is how does it know where in 3D space it is clicking?
Think of Homeworld: Cataclysm where the cursor is just like it is in Starcraft. The question is how does it know where in 3D space it is clicking?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement