Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17825

How do you maintain Spatial Hashing?

$
0
0
Hello forum! I would like to know how you handle spatial hashing in terms of updating elements. First of all, I would like to point out, I'm talking about a spatial hash where one object can be referenced in multiple hash-buckets, as it could cross the border from bucket 1 to 2. Next would be a game-object's position being updated, what do or would you do? Rebuild the entire spatial hashing (as its done with octree etc.)? Or would you maybe give each game-object a reference to its hash-buckets to make the game-object instruct deleting your game-object from its list/vector/... inside each hash-bucket referenced? If you decide to remove and then insert again - as just mentioned - I would be really interested in the way you tidy up all hash-buckets that used to have that particular object - since one object could potentially be referenced in multiple buckets (hit box being on a corner where e.g. 4 buckets meet, as stated in the beginning above). If you have any particular language-specific tricks, I would be interested in C++ ways of doing. Maybe some weak-pointer-trickery..? Thanks for your time!

Viewing all articles
Browse latest Browse all 17825

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>