• Advertisement
Sign in to follow this  

Implementing Tile collision in a 3d dimension?

This topic is 3456 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 created a flat square representing land of my map in Direct 3D and what I want to do is. Is to implement a tile collision, that show weather that spot on that area is available or not for AI, Buildings, etc can be placed or to navigate around. So I ask this: Lets say I want to allow the user to place a building that takes up 4 tiles on the map, how can I have it so DirectX knows that building will take up 4 tiles or not where the user places it and where at and being able to tell if the building will collide with another tile that is being used? DirectX 9.0, VS2005 STD, C++/Win32

Share this post


Link to post
Share on other sites
Advertisement
Sounds like your question is more about game design than about DirectX and maybe one of the other forums would be more appropriate.

However, it sounds like you need a data structure of some sort in which you store information about each tile, such as if it is "occupied."

When the user is in "place 4-tile building" mode, as the user moves the mouse around the screen, unproject the mouse position to your map surface and pick the nearest intersection of tiles. Check each of the surrounding tiles (4 of them around the intersection) and, if one of the them is "occupied," draw a red square (indicating the building can't be placed there). If all four tiles around the intersection are unoccupied, draw a green rectangle to indicate it's available.

Is that what you asking about?

Share this post


Link to post
Share on other sites
Yes, I wouldn't know where to exactly start on something like this though so I know if it will work properly or not.

thanks, Ajm113.

Share this post


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

  • Advertisement