Jump to content
  • Advertisement
Sign in to follow this  
Player_0

World editor type thing. Tile based. Some questions.

This topic is 5040 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to build a 3d tile based world editor. In the editor you can move around the map, rotate and all that stuff. I want to incorporate commands such that you can raise an axis and have the other vertices come along forming a hill or something. My problem is figuring out how to see which vertex or tile the mouse clicks on. The matrices are changing all the time because you can rotate the map and such. Im thinking that I draw a square on the map and have it follow the mouse so that when it clicks I can just get what tile the square is on. I'm still not sure how to do this but can I get comments or suggestions from others?

Share this post


Link to post
Share on other sites
Advertisement
You want some way to project the mouse's position down onto the actual world. Have you worked with raytracing at all? Because that's the way to do this (as I recall, anyway). Take the camera's aim vector and adjust it by the mouse's position on the screen (scaled by the size of the view plane). Follow that vector along until you hit something. Figure out what tile that is and you're done.

That's a very simplistic description of what to do, but it shouldn't be too hard to figure out. Good luck.

Share this post


Link to post
Share on other sites
Wont this be the same as doing readpixel in opengl? No I've never gotten into raytracing can you give some good material I can look at? I know theres a lot about it but never found anything I could really follow and make work.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
I know theres a lot about it but never found anything I could really follow and make work.


That sounds like a personal problem. Maybe your too dumb to be doing this or just plain lazy?

Share this post


Link to post
Share on other sites
i say its a good thing your anonymus you flamer!
its people like you who discorage others from doing somthing.

if you dont know alot about raytracing heres some sites i found some source of one that you can use as an example (if you really want to learn that stuff make your own dont copy)

http://homepages.paradise.net.nz/nickamy/simpleraytracer/simpleraytracer.htm <--windows only

some tutorials:
http://flipcode.org/articles/tut_raytrace01.shtml

i hope this is what you are looking for and good luck [grin]




Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!