Sign in to follow this  
Player_0

World editor type thing. Tile based. Some questions.

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this