• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Detecting Adjacent Buildings

Status
Not open for further replies.
Level 23
Joined
Oct 12, 2008
Messages
1,783
How do I go about detecting if a building is adjacent to another?

1. I understand that a 4x4 pathing (ie. farm type) is a 128x128 square in editor.
2. Simply drawing a region around the structure doesnt work when buildings are of larger pathing or when 2 buildings have a different pathing shape.
 
Level 23
Joined
Oct 12, 2008
Messages
1,783
Maybe you can calculate an approximation from Doc - BlzGetUnitCollisionSize
If you want to account for pathing shape, I think you'd need to "map out" the building outline with unit/item setpos and then see where the item/unit were actually moved by the game. Sure the next question is, do you need that accuracy?

Thanks for the reply
1. Unfortunately, pathing size (for buildings) doesnt not equal with collision size. Collision size does increase with pathing size but the number is not the same.
2. I dont quite understand what you mean by "do you need the accuracy?"
 
Level 40
Joined
Feb 27, 2007
Messages
5,092
It might be possible to read this data at runtime in some way using unit field natives? I didn't check. It could also be possible to export the unit/object data for a map, read it with an external program, and extract building pathing shape information from that; then import that data in a sensible way into the map and build a hashtable to be read at runtime.
 
Status
Not open for further replies.
Top